I'm beginner for graphical prog. in C++,
#include %26lt;graphics.h%26gt;
#include %26lt;stdlib.h%26gt;
#include %26lt;stdio.h%26gt;
#include %26lt;conio.h%26gt;
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(%26amp;gdriver, %26amp;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); /* return with error code */
}
/* draw a line */
line(0, 0, getmaxx(), getmaxy());
/* clean up */
getch();
closegraph();
return 0;
}
But this programme show error while linking after compilation,
like, undefined symbol intigraph in module %26lt;prog. name.cpp%26gt;
undefined symbol line in module %26lt;prog. name.cpp%26gt;
undefined symbol graphresult in module %26lt;prog. name.cpp%26gt;
Pls. Help......
I have this programme, which is meant for some graphical interface, but is gives error, why?
I don't know how to fix your error, but what I can tell you to do is: remove it and install it again more carefully
Reply:I'm not familiar with the proprietary graphics library you're using, although it does reek of Borland. However, I'm not at all sure that this line does what you think it does:
int gdriver = DETECT, gmode, errorcode;
Are you sure you don't mean to set gdriver to the result of some function call or perhaps the result of a macro? Maybe it should be
int gdriver = DETECT(gmode, errorcode);
Check your graphics library's documentation. Sorry I can't be of more help.
Reply:Anyway, initgraph is a TurboC function, you have to use that compiler (if I remember well it's free at Borland website). Have a look at
http://www.electrosofts.com/cgraphics/in...
To know all requisites you need in order to link correctly..
Best Wishes..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment