Linker Error Undefined Reference To Wsastartup8
Contents |
here for a quick overview of undefined reference to wsastartup@8' code blocks the site Help Center Detailed answers to any questions undefined reference to wsastartup@8' dev c++ you might have Meta Discuss the workings and policies of this site About undefined reference to `wnetaddconnection2a@16' Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Undefined Reference To Getaddrinfo
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MinGW linker error: winsock up vote mingw winsock 28 down vote favorite 11 I am using MinGW compiler on Windows to compile my C++ application with sockets. My command for linking looks like: g++.exe -Wall -Wno-long-long -pedantic -lwsock32 -o dist/Windows/piskvorky { there are a lot of object files } and I have also tried g++.exe -Wall -Wno-long-long -pedantic -lws2_32 -o dist/Windows/piskvorky { there are a lot of object files } but in both case I get this error: build/Windows/MinGW-Windows/src/utils/tcpunit.o:tcpunit.cpp:(.text+0x33): undefined reference to `closesocket@4' build/Windows/MinGW-Windows/src/utils/tcpunit.o:tcpunit.cpp:(.text+0xd0): undefined reference to `send@16' build/Windows/MinGW-Windows/src/utils/tcpunit.o:tcpunit.cpp:(.text+0x1ee): undefined reference to `recv@16' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x184): undefined reference to `WSAStartup@8' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x1a5): undefined reference to `closesocket@4' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x1cb): undefined reference to `closesocket@4' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x1d3): undefined reference to `WSACleanup@0' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x6fe): undefined reference to `bind@12' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x724): undefined reference to `listen@8' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x7f0): undefined reference to `gethostbyaddr@12' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x83c): undefined reference to `socket@12' build/Windows/MinGW-Windows/src/utils/tcpdevice.o:tcpdevice.cpp:(.text+0x86f): undefined reference to `htons@4' build/Windo
Programming Boards C Programming undefined reference to `WSAStartup@8' Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes lws2_32 for common problems Thread: undefined reference to `WSAStartup@8' Thread Tools Show Printable Version Email
Undefined Reference To `_uuidfromstringa@8'
this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-05-2005 #1 wicked View Profile
Undefined Reference To `doformatmessage'
View Forum Posts Registered User Join Date Jan 2005 Posts 11 undefined reference to `WSAStartup@8' As the topic suggests I'm having trouble linking libs under Dev C++ 4(windows 2000). Also when creating a C project http://stackoverflow.com/questions/2033608/mingw-linker-error-winsock all my code I write providing it's more than a simple "hello world" kind of application doesn't seem to compile unless I change it's source file to .cpp rather than .c and no I'm not using c++ functions in the program. To get around these problems I've been having I've had to use MSVC++ changing the .c file to .cpp and use #pragma comment(lib, "wsock32.lib") rather than linking libs normally. wicked 01-05-2005 http://cboard.cprogramming.com/c-programming/60326-undefined-reference-%60wsastartup@8.html #2 Fordy View Profile View Forum Posts Visit Homepage &TH of undefined behavior Join Date Aug 2001 Posts 5,792 If memory serves correct, the libraries in DevC++ have a different naming convention to other compilers. In most compilers you would use "wsock32.lib", but I think in DevC++ it's called "libwsock32.a" or something similar. Try find this lib and link to it. Board Rules Blog 01-05-2005 #3 wicked View Profile View Forum Posts Registered User Join Date Jan 2005 Posts 11 Thats the thing, I've got no idea how to link to it via Dev C++ 4. wicked 01-05-2005 #4 anonytmouse View Profile View Forum Posts Yes, my avatar is stolen Join Date Dec 2002 Posts 2,544 Add "-lwsock32" (without the quotes) to the linker box under Project->Project Options->Parameters. If you have not set up a project, you will have to do that first. Go to File->New->Project->Empty Project. Then add your files by using Project->Add to Project. If you want to link with other windows libraries you can use the same syntax. For example, "-lgdi32 -ladvapi32" will link to gdi32.lib and advapi32.lib. 01-05-2005 #5 wicked View Profile View Forum Posts Registered User Join Date Jan 2005 Posts 11 Project->Project Options->Parameters. I fail to see a parameters option. Yes I've done everything else correctly. wicked 01-05-2
Database CPUs Solaris Novell OpenVMS DOS Unix Mac Lounge Login» http://www.computing.net/answers/programming/dev-c-compier-just-not-working-/24305.html Register» Connect» Hardware & Devices ▼ General Hardware CPUs/Overclocking Networking See More... Software ▼ Security and Virus Office Software PC Gaming See More... Operating Systems ▼ Windows 10 Windows 8 Windows 7 Windows XP See More... Off-Topic Tags How-tos Drivers Ask a Question Computing.NetForumsProgrammingC/C++ Solved DEV C++ Compier just NOT working :/ Tags:Programmingerror message Xploit undefined reference February 12, 2011 at 09:06:33 Specs: Windows 7 I have no idea why it's not working. I thought i may be writing programs with poor syntax or something but even when i run the example programs. It shows errors D: Here's some example code:#include