C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28695
Number of posts: 94715

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Function should have prototype?? Posted by cuongmits on 27 Feb 2006 at 12:36 PM
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??

 #include <iostream.h>
#include <conio.h>
#include <graphics.h>
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\n" << 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;
} 

Report
Re: Function should have prototype?? Posted by Bodkin on 27 Feb 2006 at 12:45 PM
The exit() method is defined in:
#include <stdlib.h>

Report
Re: Function should have prototype?? Posted by cuongmits on 27 Feb 2006 at 1:51 PM
This message was edited by cuongmits at 2006-2-27 14:4:13

: The exit() method is defined in:
:
#include <stdlib.h>

:
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 (?)


Report
Re: Function should have prototype?? Posted by HK_MP5KPDW on 27 Feb 2006 at 2:26 PM
: This message was edited by cuongmits at 2006-2-27 14:4:13

: : The exit() method is defined in:
: :
#include <stdlib.h>

: :
: 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 (?)
:
:
:

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.

Report
Re: Function should have prototype?? Posted by cuongmits on 27 Feb 2006 at 2:36 PM
: : This message was edited by cuongmits at 2006-2-27 14:4:13

: : : The exit() method is defined in:
: : :
#include <stdlib.h>

: : :
: : 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 (?)
: :
: :
: :
:
: 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.
:
:
Yes, those functions declared in the graphics.h header.
I dont know about error with linker, my directories are:
C:\TC\INCLUDE (include directories)
C:\TC\LIB (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.
Report
Re: Function should have prototype?? Posted by Lundin on 28 Feb 2006 at 12:20 AM
: : : This message was edited by cuongmits at 2006-2-27 14:4:13

: : : : The exit() method is defined in:
: : : :
#include <stdlib.h>

: : : :
: : : 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 (?)
: : :
: : :
: : :
: :
: : 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.
: :
: :
: Yes, those functions declared in the graphics.h header.
: I dont know about error with linker, my directories are:
: C:\TC\INCLUDE (include directories)
: C:\TC\LIB (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 TC\bgi folder.
Report
Re: Function should have prototype?? Posted by AsmGuru62 on 28 Feb 2006 at 1:12 AM
Why the error messages are in uppercase?
I think the problem may be deeper than missing libraries.

Report
Re: Function should have prototype?? Posted by cuongmits on 28 Feb 2006 at 7:43 AM
: Why the error messages are in uppercase?
: I think the problem may be deeper than missing libraries.
:

:
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!!
Report
Re: Function should have prototype?? Posted by antrockz on 25 Aug 2008 at 1:13 PM
: 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??
:
:
:  #include <iostream.h>
: #include <conio.h>
: #include <graphics.h>
: 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\n" << 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;
: } 
:



Soln: exit() function is defined in <process.h>.


Report
Re: Function should have prototype?? Posted by Lundin on 3 Sept 2008 at 5:30 AM
The thread is 2 years old...

And process.h doesn't exist in ISO C nor ISO C++, it is a non-standard header. exit() is found in stdlib.h.
Report
Re: Function should have prototype?? Posted by garg08san on 25 Aug 2012 at 8:29 AM
write return(0); instead of return 0. try it!! it may work...
Report
Re: Function should have prototype?? Posted by garg08san on 25 Aug 2012 at 8:30 AM
write return(0); instead of return 0. try it!! it may work...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.