Hi Friends ,
This is Ganeshan . I Found the Below undefined errors when using Socket programming on Eclipse IDE . I don't know what to do ?. Kindly please help me in removing the Errors .

[Linker error] undefined reference to `WSAStartup@8'
[Linker error] undefined reference to `socket@12'

Thanks
Regards

Recommended Answers

All 3 Replies

you have to link with ws2_32.lib

Hi ,

I tried linking using the Praqma Comment shown below :-

#pragma comment (lib, "Ws2_32.lib")

Even doing this i could not resolve the error .

Regards
Ganeshan S

that pragma may not be recognized by your compiler. Try adding the library in the project settings. I don't use that compiler so I don't know how that's done.

Or you could just get a better compiler, such as free Code::Blocks with MinGW.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.