Using gcc
Claudio Bley
bley@mail.cs.uni-magdeburg.de
Fri Sep 14 09:14:00 GMT 2001
>>>>> " " == charles scott <cpscott@nsu.edu> writes:
> Hello, I am new to GNU CC and I have version gcc 3.0.1 running on
> Solaris 8. The package seemed to install okay and I added the
> /usr/local/bin directory to my path however, when I compile my c++
> program it returns the following message:
> `main' must return `int'
> Here is the code.
> #include <iostream.h>
> void main()
> {
> long number = 0;
> cout << "This is a test. " << number << endl;
> }
> Is there a place where I get some sample c++ code that will compile
> to test my install?
> Thanks for your assistance.
Just do what the compiler suggests/dictates!
#include <iostream> /* include C++ header files without .h */
int main () /* `main' must return `int' !! */
{
using namespace std; /* cout is declared in namespace std */
long number = 0;
cout << "This is a test. " << number << endl;
return 0;
}
Claudio
More information about the Gcc-help
mailing list