Just for notes, I'm using VisualStudio 2003.

I'm working on a program that's supposed to make the Muller-Lyer illusion. I've got all of the coding done, but now when I try to run it all I get is a load of errors. First, it starts to compile the program and pops up a box saying, "There were build errors. Continue?" I hit continue anyways, and then it says "Unable to start debugging. Unable to start program "[Blah blah]." The system cannot find the file specified. On top of that, once I close that window, down in the task list window it gives a list of 'error LNK2019: unresolved external symbol' things. I'm really new to C++ and I have no clue of what to do. I'm not asking for a handout, I just need to know what I'm doing wrong. Thanks in advance!

// Program file: mullyer.cpp

// Displays the image that causes the Muller-Lyer illusion

#include "C:\Graphics\graphics.h"

int main()
{
	initGraph();
	return 0;
}

void renderScene()
{
	// Draw the two-headed arrow

	moveTo(30, 30);
	lineTo(180, 30);
	moveTo(30, 30);
	lineTo(60, 0);
	moveTo(30, 30);
	lineTo(60, 60);
	moveTo(180, 30);
	lineTo(150, 0);
	moveTo(180, 30);
	lineTo(150, 60);

	// Draw the two-tailed arrow

	moveTo(30, 100);
	lineTo(180, 100);
	moveTo(30, 100);
	lineTo(0, 70);
	moveTo(30, 100);
	lineTo(0, 130);
	moveTo(180, 100);
	lineTo(210, 70);
	moveTo(180, 100);
	lineTo(210, 130);

	// Label the drawing

	outText(0, 250, "The Muller-Lyer illusion");

}

Well most of us aren't mind readers here so provide some errors for us to look at.

>> #include "C:\Graphics\graphics.h"

replace \ with \\

Might/mightn't solve some of your problems.

Well the short answer to the problem is that you're trying to use a graphics API for a long-dead DOS compiler, and you're using something rather more up to date.

What you do about it is rather more complicated however. For a start, there are many more graphic API's available to you.

API's like DirectX and OpenGL are highly featured, but take quite a lot of getting used to. At the other end of the scale, you can use simple Win32 GDI commands to draw simple 2D scenes like the one you're trying to draw.

Somewhere in the middle are things like LibSDL and allegro

Let me guess: Your using visual c++ 6 and some subpar textbook that uses outdated headers. The class is taught by some loser who is too stupid to get a real job actually programming. In fact judging by the time of year, you are on Chapter 2 which is titled "Graphics" or something of the sort. My advice: get a real c++ book, one that wasn't published in 1992. Don't expect to get anything out of this class.

This article has been dead for over six months. Start a new discussion instead.