winsock2.h and ws2tcpip.h linking error

1,247 views
Skip to first unread message

Ahmed Nasrallah

unread,
Apr 19, 2021, 8:53:14 AM4/19/21
to OMNeT++ Users
Hello,

I've got a small problem where I'm creating a client using windows socket programming in my omnet project but I have a problem linking ws2tcpip.h and winsock2.h (see error below). I tried adding -L ws2_32 in the LIB part of the makefile but every time I build it, it gets erased. I am not sure how to solve this issue in the Omnet IDE using Ecplise.
I am using Omnet 5.6.2 on windows 10. 

Any help is appreciated.

../out/clang-release/src/cnc.o:(.text+0x2e18): undefined reference to `__imp_WSAStringToAddressA'
../out/clang-release/src/cnc.o:(.text+0x2ec4): undefined reference to `__imp_WSAAddressToStringA'
../out/clang-release/src/cnc.o:(.text+0x2f6e): undefined reference to `__imp_socket'
../out/clang-release/src/cnc.o:(.text+0x2f8d): undefined reference to `__imp_htons'
../out/clang-release/src/cnc.o:(.text+0x3020): undefined reference to `__imp_WSAStringToAddressA'
../out/clang-release/src/cnc.o:(.text+0x3082): undefined reference to `__imp_connect'
../out/clang-release/src/cnc.o:(.text+0x30a0): undefined reference to `__imp_send'


Thanks,
Ahme

Alfonso Ariza Quintana

unread,
Apr 20, 2021, 5:37:24 AM4/20/21
to omn...@googlegroups.com
You need to include the librarires in the project properties

project features -> OMNeT++ -> Makemake options -> Link -> more

De: omn...@googlegroups.com <omn...@googlegroups.com> en nombre de Ahmed Nasrallah <ahna...@asu.edu>
Enviado: lunes, 19 de abril de 2021 14:53
Para: OMNeT++ Users <omn...@googlegroups.com>
Asunto: [Omnetpp-l] winsock2.h and ws2tcpip.h linking error
 
--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/4e5c9359-f030-4018-927c-8b159dd2d146n%40googlegroups.com.

Ahmed Nasrallah

unread,
Apr 20, 2021, 5:53:27 AM4/20/21
to omn...@googlegroups.com
Thank you very much for the information. It solved the issue and now it shows in the Makefile as well.



--
Ahmed Nasrallah
ASU Tempe, Student
PhD Computer Engineering
School of Electrical, Computer, and Energy Engineering (ECEE)

Reply all
Reply to author
Forward
0 new messages