Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Trying to statically link enet libraries not working.
So I am developing in QT 5 on windows 7 using qt creator.
I wanted to link enet library found http://enet.bespin.org/
I used qt creator to add statically linked external library and selected the enet64.lib and even tried adding in enet.lib but it doesn't seem to register the linkage at all.
Some help would be greatly appreciated. Thanks!
Some more info:
I tried including the enet64.lib and enet.lib in the pro file by copying the enet libraries into the directory and using LIBS += -lenet64 and LIBS += -lenet
Then I included the necessary header files found in the directory.
However it keeps saying that I have unresolved external symbol which should be defined in the library.
bodzio131 last edited by
Have you added both 64/32 bit library into the same build process? If yes then you should use only apropriate version, not both together.
Could you attach full error message from linker? I would like to see which symbol is missed.
Have you check if enet library already contains the missed symbol?
So, my pro file looks like so:
Project created by QtCreator 2013-07-20T21:20:18
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = EnetTest
TEMPLATE = app
SOURCES += main.cpp
HEADERS += MainWindow.h
FORMS += MainWindow.ui
LIBS += -LC:/testDirectory/enetTest -lenet64@
And my main looks like so:
int main(int argc, char *argv)
QApplication a(argc, argv);
I compiled it with MSVC 2012 64 bit option in qt creator.
When I call enet_initialize() it says things like: unresolved exernal symbol (name of function) referenced in function enet_initialize(and other functions inside the library) ...... enet64.lib(win32.o).
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _enet_initialize
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__timeBeginPeriod@4 referenced in function _enet_initialize
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _enet_initialize
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__timeEndPeriod@4 referenced in function _enet_deinitialize
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__getsockname@12 referenced in function _enet_socket_get_address
enet.lib(win32.o):-1: error: LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function _enet_socket_set_option
bodzio131 last edited by
Well, these are not unresolved symbols from enet library :) Look into "Windows Winsock API":http://msdn.microsoft.com/en-us/library/windows/desktop/ms741394(v=vs.85).aspx, you need to link against Ws2_32.lib.
Oh thanks! That was the problem.... I didn't realize these were required libraries. I added -lwinmm and -lws2_32 and it compiles!