I have installed Turbo C++ 3.0 an tried to run it with the following program. But one mistake have appeared, and I dont know how to fix it. The comment of error: FUNTION _EXIT SHOULD HAVE A PROTOTYPE!! Maybe prob with compiler??
[code]
#include #include #include int main(){
clrscr();
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
cout << "Graphics error: %s
" << grapherrormsg(errorcode);
cout << "Press any key to halt:";
getch();
exit(1); /* return with error code */
}
circle(100,200,50);
// cout << "Hello world";
getch();
return 0;
} [/code]
Comments
[code]#include [/code]
: The [italic]exit()[/italic] method is defined in:
: [code]#include [/code]
:
Thanks for you advice, but when I tried to add STDLIB.H, I got these errors:
UNDEFINED SYMBOL _CIRCLE IN MODULE HELP.CPP (HELP.CPP my program)
UNDEFINED SYMBOL _GRAPHERRORSMS IN MODELE HELP.CPP
UNDEFINED SYMBOL _GRAPHRESULT IN MODULE HELP.CPP
UNDEFINED SYMBOL _INITGRAPH IN MODULE HELP.CPP
p/s this program I copy from documentation of TURBO C++ 3.0, it must work or there is problem with compiler or installation (?)
: : The [italic]exit()[/italic] method is defined in:
: : [code]#include [/code]
: :
: Thanks for you advice, but when I tried to add STDLIB.H, I got these errors:
:
: UNDEFINED SYMBOL _CIRCLE IN MODULE HELP.CPP (HELP.CPP my program)
: UNDEFINED SYMBOL _GRAPHERRORSMS IN MODELE HELP.CPP
: UNDEFINED SYMBOL _GRAPHRESULT IN MODULE HELP.CPP
: UNDEFINED SYMBOL _INITGRAPH IN MODULE HELP.CPP
:
: p/s this program I copy from documentation of TURBO C++ 3.0, it must work or there is problem with compiler or installation (?)
:
:
:
[blue]Are those functions declared in the graphics.h header? Or... are those linker errors? If they are linker errors and not compiler errors, have you added the appropriate library to your project settings? It may not be (probably isn't) one that is included in default projects.[/blue]
: : : The [italic]exit()[/italic] method is defined in:
: : : [code]#include [/code]
: : :
: : Thanks for you advice, but when I tried to add STDLIB.H, I got these errors:
: :
: : UNDEFINED SYMBOL _CIRCLE IN MODULE HELP.CPP (HELP.CPP my program)
: : UNDEFINED SYMBOL _GRAPHERRORSMS IN MODELE HELP.CPP
: : UNDEFINED SYMBOL _GRAPHRESULT IN MODULE HELP.CPP
: : UNDEFINED SYMBOL _INITGRAPH IN MODULE HELP.CPP
: :
: : p/s this program I copy from documentation of TURBO C++ 3.0, it must work or there is problem with compiler or installation (?)
: :
: :
: :
:
: [blue]Are those functions declared in the graphics.h header? Or... are those linker errors? If they are linker errors and not compiler errors, have you added the appropriate library to your project settings? It may not be (probably isn't) one that is included in default projects.[/blue]
:
:
Yes, those functions declared in the graphics.h header.
I dont know about error with linker, my directories are:
C:TCINCLUDE (include directories)
C:TCLIB (library directories)
(these links are automatically declared when I installed)
[quote] have you added the appropriate library to your project settings? [/quote] >> how to do it?
I doubt the process of installation maybe problem there when I tried to install TURBO C++ 3.0 without reading readme file (?)
Thank you.
: : : : The [italic]exit()[/italic] method is defined in:
: : : : [code]#include [/code]
: : : :
: : : Thanks for you advice, but when I tried to add STDLIB.H, I got these errors:
: : :
: : : UNDEFINED SYMBOL _CIRCLE IN MODULE HELP.CPP (HELP.CPP my program)
: : : UNDEFINED SYMBOL _GRAPHERRORSMS IN MODELE HELP.CPP
: : : UNDEFINED SYMBOL _GRAPHRESULT IN MODULE HELP.CPP
: : : UNDEFINED SYMBOL _INITGRAPH IN MODULE HELP.CPP
: : :
: : : p/s this program I copy from documentation of TURBO C++ 3.0, it must work or there is problem with compiler or installation (?)
: : :
: : :
: : :
: :
: : [blue]Are those functions declared in the graphics.h header? Or... are those linker errors? If they are linker errors and not compiler errors, have you added the appropriate library to your project settings? It may not be (probably isn't) one that is included in default projects.[/blue]
: :
: :
: Yes, those functions declared in the graphics.h header.
: I dont know about error with linker, my directories are:
: C:TCINCLUDE (include directories)
: C:TCLIB (library directories)
: (these links are automatically declared when I installed)
:
: [quote] have you added the appropriate library to your project settings? [/quote] >> how to do it?
:
: I doubt the process of installation maybe problem there when I tried to install TURBO C++ 3.0 without reading readme file (?)
:
: Thank you.
:
Been ages sence I did anything with BGI... you can try:
- Options->Linker->Libraries->Graphics Library should be marked
- If it doesn't help, add the file EGAVGA.BGI to the project. It is located in the TCgi folder.
I think the problem may be deeper than missing libraries.
[/blue]
: I think the problem may be deeper than missing libraries.
: [/blue]
:
Thank everyone so much for your help. I have copied every files in CLASSLIB into INCLUDE and LIB and my proga did work perfectly. The reason maybe is there was not stdlib or other libraries, when I tried to change line EXIT(1); to RETURN 1; then program dont need to include stdlib.
Till now I dont know why people separate folders CLASSLIB and INCLUDE, LIB in TURBRO C++ 3.0??
Once again, thanks so much!!
: program. But one mistake have appeared, and I dont know how to fix
: it. The comment of error: FUNTION _EXIT SHOULD HAVE A PROTOTYPE!!
: Maybe prob with compiler??
:
: [code]: #include
: #include
: #include
: int main(){
: clrscr();
:
: /* request auto detection */
: int gdriver = DETECT, gmode, errorcode;
:
: /* initialize graphics mode */
: initgraph(&gdriver, &gmode, "");
:
: /* read result of initialization */
: errorcode = graphresult();
:
: if (errorcode != grOk) /* an error occurred */
: {
: cout << "Graphics error: %s
" << grapherrormsg(errorcode);
: cout << "Press any key to halt:";
: getch();
: exit(1); /* return with error code */
: }
:
: circle(100,200,50);
: // cout << "Hello world";
: getch();
: return 0;
: } [/code]:
Soln: exit() function is defined in <process.h>.
And process.h doesn't exist in ISO C nor ISO C++, it is a non-standard header. exit() is found in stdlib.h.
http://learnturboc.blogspot.com.au/2012/05/coding-functions-in-c.html
http://learnturboc.blogspot.com.au/2012/05/use-of-functions.html
http://learnturboc.blogspot.com.au/2012/05/coding-functions-in-c.html
http://learnturboc.blogspot.com.au/2012/05/use-of-functions.html