Put the -lws2_32
AFTER the list of object files – GCC searches libraries and object files in the order they appear on the command line.
Just to help the other viewers out there:
gcc hello.c -o hello.o -lws2_32
More Related Contents:
- How to solve ——-undefined reference to `__chkstk_ms’——-on mingw
- Error when building a C++ program for the second time [closed]
- Why do I get “unresolved external symbol” errors when using templates? [duplicate]
- Splitting templated C++ classes into .hpp/.cpp files–is it possible?
- How does C++ linking work in practice? [duplicate]
- What do linkers do?
- std::stoi doesn’t exist in g++ 4.6.1 on MinGW
- Building glew on windows with mingw
- wWinmain, Unicode, and Mingw
- Difference between shared objects (.so), static libraries (.a), and DLL’s (.so)?
- Properly print utf8 characters in windows console
- What do C and Assembler actually compile to? [closed]
- Undefined reference error for template method [duplicate]
- How to link using GCC without -l nor hardcoding path for a library that does not follow the libNAME.so naming convention?
- How to link winsock.lib?
- Program can’t find libgcc_s_dw2-1.dll [duplicate]
- How to enable experimental C++11 concurrency features in MinGW?
- How does the linker handle identical template instantiations across translation units?
- Using pthread in c++
- static variables in an inlined function
- Can I link a plain file into my executable? [duplicate]
- Static and Dynamic/Shared Linking with MinGW
- Can different GCC dialects be linked together?
- cmake – Global linker flag setting (for all targets in directory)
- Getting Clang to work on windows
- Linking C++ code with ‘gcc’ (without g++)
- How to force inclusion of an object file in a static library when linking into executable?
- Undefined symbols for architecture x86_64 – Mavericks (Yosemite, El Capitan…)
- How to Embed/Link binary data into a Windows module
- How to reduce the size of executable produced by MinGW g++ compiler?