Re: dinkumware 402 linking with g++ 3.x/ _Winit undefined ref

From: Unforgiven (jaapd3000_at_hotmail.com)
Date: 12/08/03


Date: Mon, 8 Dec 2003 18:11:44 +0100

david wrote:
> Hi,
>
> I have some problems to link a simple hello world program using
> g++ (version 3.2.3 or 3.3) and dinkumware 402.
>
> //hallo world...
> #include <iostream>
> main () {
> std::cout << "bla" << std::endl;
> }

I'm guessing it chokes on the fact that the main() you have defined is not
actually a function definition. Try this:

#include <iostream>
int main() {
    std::cout << "bla" << std::endl;
    return 0;
}

NOTE: int is the *only* valid return type for main(). void main() is not,
never has been, and never will be, valid C++. For main() without return type
it's the same story. Afaik, the only functions that you can (must, even)
declare without return type are constructors and destructors.

-- 
Unforgiven


Relevant Pages