Register and join over 40,000 other developers!
Recent Topics
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
-
Job Gig PHP Form Needed
PJohnson - Apr 18 2019 03:55 AM
-
How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
-
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

1 reply to this topic
#1
Posted 23 September 2012 - 09:58 AM
I am having some trouble compiling a little program I found on the internet. it has no errors but it does have a lot of undefined references (about 20) to things. Here are the errors.:
Compiling: C:\Users\Daniel\Desktop\main.cpp
Linking console executable: bin\Release\Networking.exe
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x24): undefined reference to `_WSAStartup@8'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x50): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x78): undefined reference to `_socket@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0xb3): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0xd2): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x10d): undefined reference to `_send@16'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x144): undefined reference to `_recv@16'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x168): undefined reference to `_closesocket@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x23c): undefined reference to `_listen@8'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x269): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x293): undefined reference to `_accept@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x2bf): undefined reference to `_accept@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x2f3): undefined reference to `_inet_addr@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x309): undefined reference to `_htons@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x333): undefined reference to `_bind@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x360): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3b3): undefined reference to `_inet_addr@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3c9): undefined reference to `_htons@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3f3): undefined reference to `_connect@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x420): undefined reference to `_WSACleanup@0'
I think I am not giving the linker the correct -l statements. the linker settings are -mwindows and thats it.
Compiling: C:\Users\Daniel\Desktop\main.cpp
Linking console executable: bin\Release\Networking.exe
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x24): undefined reference to `_WSAStartup@8'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x50): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x78): undefined reference to `_socket@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0xb3): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0xd2): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x10d): undefined reference to `_send@16'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x144): undefined reference to `_recv@16'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x168): undefined reference to `_closesocket@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x23c): undefined reference to `_listen@8'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x269): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x293): undefined reference to `_accept@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x2bf): undefined reference to `_accept@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x2f3): undefined reference to `_inet_addr@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x309): undefined reference to `_htons@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x333): undefined reference to `_bind@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x360): undefined reference to `_WSACleanup@0'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3b3): undefined reference to `_inet_addr@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3c9): undefined reference to `_htons@4'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x3f3): undefined reference to `_connect@12'
obj\Release\C\Users\Daniel\Desktop\Socket.o:Socket.cpp:(.text+0x420): undefined reference to `_WSACleanup@0'
I think I am not giving the linker the correct -l statements. the linker settings are -mwindows and thats it.
#2
Posted 23 September 2012 - 08:49 PM
Can you show the code here? The linking errors are because linker is not able to find the library/DLL for all those API the code used.
However, it seems you are trying with Visual Studio, right? If yes, you just need to properly apply linker settings to link to 'Ws2_32.lib'. To do that read the tutorial here -- go to section 'How to Link to 3'rd Party Libraries'
However, it seems you are trying with Visual Studio, right? If yes, you just need to properly apply linker settings to link to 'Ws2_32.lib'. To do that read the tutorial here -- go to section 'How to Link to 3'rd Party Libraries'
Also tagged with one or more of these keywords: c++, winsock, linker, libraries
Language Forums →
C and C++ →
Do you use any debuggers except the standard for Visual Studio?Started by Fernando, 25 Jan 2019 ![]() |
|
![]() |
||
Tutorial Forums →
C/C++ Tutorials →
Basic C++ Game Hacking TutorialStarted by DaDopeman, 12 Aug 2018 ![]() |
|
![]() |
||
Language Forums →
C and C++ →
basic c++ question, difference between a and a&Started by Siten0308, 10 Oct 2017 ![]() |
|
![]() |
||
Language Forums →
C and C++ →
help me . c++. ArraysStarted by girl2383, 06 Feb 2017 ![]() |
|
![]() |
||
Language Forums →
C and C++ →
Trying to makes sense of unnamed namespace and extern useStarted by sonar87, 25 Jan 2017 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download