Reply-To: From: "Arthur" To: "DJGPP Mailing List" , "Jason" Subject: RE: Why doesn't C++ work!?!?! Date: Fri, 4 Sep 1998 11:38:53 +0100 Message-ID: <000101bdd7f0$3648b760$ca4e08c3@arthur> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit In-reply-to: <35EF0D07.DC9983E1@sandia.gov> Importance: Normal Precedence: bulk > Hey guys: > > I have not been able to get any C++ programs compiled - and on the DJGPP > website, it says that gcc should know what to to with the file according > to the file's extenstion. I tried to compile a simple C++ program that > couts one line (it looks like this): > > #include > > main(void) > { > cout << "This is a test."; > } C++ is VERY picky about implicit declarations. It will throw a wobbley if you don't define main() as int main() (any function parameters not declared will be counted as void in C++, but not in C). main() always returns an int (even in C), but C won't shout at you half as much as C++ will. Also note that at the end of the program you must have a return 0; or something to shouw that it exits properly. And more picking with your code. C++ standards state that you should output an endl at the end of each line you stream to the stdout. gcc will not link with the C++ libraries according to extension. To do this you must use gxx (which will). So your code should be: #include int main() { cout << "This is a test." << endl; return 0; } and then compile it with gxx. HTH James Arthur jaa AT arfa DOT clara DOT net ICQ#15054819