Question:
why i have error like this "undefined symbol initgraph();"in turbo c++ program?
adrian
2010-03-09 18:15:37 UTC
this my program

#include
#include
#include
#include

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 100;

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}

midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());

/* draw the circle */
circle(midx, midy, radius);

/* clean up */
getch();
closegraph();
return 0;
}
Three answers:
Mark aka jack573
2010-03-13 08:32:37 UTC
it usually means that the compiler cannot find the function initgraph.



Check what file it is in. You may also need to use a namespace to get the function recognized. I have not used graphics.h myself, so I cannot say.



If you check the header file that has the function in it, check if the function is within a block that says something like this:

namespace



If so, you will need this line below your include statements:

using namespace




Of course, change
to the actual name being used, like:

using namespace std;
?
2016-12-14 19:12:25 UTC
UNDEFINED image: '_main' IN MODULE C0.ASM: each C software might desire to comprise a function noted as significant(). that's the 1st function completed on your software. The function call might desire to be all in decrease case. if your software would not have one, create one. while you're employing dissimilar source data, the document that is composed of the function significant() might desire to be between the data listed in the undertaking. word that an underscore character '_' is prepended to all exterior quicker C++ symbols. besides to an absent, misspelled or mis-cased image significant, there are 2 added hassle-loose reasons: The "generate underbars" option is disabled. The Pascal calling convention fairly than the C calling convention is chosen. From the code i think of you have become that blunders in all risk by using this reason: "...while you're employing dissimilar source data, the document that is composed of the function significant() might desire to be between the data listed in the undertaking..."
Anthony P
2010-03-09 18:23:29 UTC
This is usually the hard drive of the computer telling you that something is corrupt in those files, so you might want to delete what ever program that is and re-install.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...