linker - Undefined reference to __dso_handle_ - compiling C++ on cygwin -


I have a basic Hello World C ++ program that I am compiling and trying I Sigwin with G ++ . The code is:

  #include & lt; Iostream & gt; using namespace std; Int main () {cout & lt; & Lt; "Hello world." & Lt; & Lt; Endl; Return 0; }  

Compile with: g ++ helloWorld.cpp -h result occurs in the following error:
/tmp/ccDO1S4J.o : HelloWorld CPP :( rdata $ .refptr .__ dso_handle [.refttr .__ dso_handle] + 0x0): __Do_handle 'undefined reference to the collection of' collection2: Error: LD returned 1 exit status '

I am reading on some other threads which indicate that this may be a linky issue and that is implementing the linker separately or with some other surahs of verbose output Can bring

So, I did:
1. G ++ - C Hello World CPP-O Hello World. O (this works - no error).
2. LD-O hello word. There are so many reasons __main or std :: cout etc. Undefined reference for errors.

I think this is a linking issue and I probably need to add another library. It is most welcome to have no sign of how to solve it.

G ++ via the installer application cygwin .


Comments