Answer the question
In order to leave comments, you need to log in
How to connect a static library to a project in QT Creator under windows?
I'm trying to connect the P7 static logger library to my application. I built the logger using cmake according to the instructions in the documentation, i.e.
cd *p7_folder_path*
mkdir *_build_*
cd *_build_*
cmake ..
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../logger/_build_/Sources/release/ -lp7
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../logger/_build_/Sources/debug/ -lp7
INCLUDEPATH += $$PWD/../../logger/_build_/Sources/Debug
DEPENDPATH += $$PWD/../../logger/_build_/Sources/Debug
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../logger/_build_/Sources/release/libp7.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../logger/_build_/Sources/debug/libp7.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../logger/_build_/Sources/release/p7.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../logger/_build_/Sources/debug/p7.lib
SOURCES += \
main.cpp
INCLUDEPATH += D:/Example/logger/Headers
#include <iostream>
#include "GTypes.h"
#include "P7_Client.h"
#include "P7_Trace.h"
using namespace std;
int main()
{
IP7_Client* l_pClient = P7_Create_Client( TM( "/P7.Sink=FileTxt" ) );
if ( l_pClient == NULL ) {
cout << "Error IP7_Client" << endl;
}
IP7_Trace* l_pTrace = P7_Create_Trace( l_pClient, TM( "Test" ) );
l_pTrace->P7_WARNING( 0, TM( "Test" ) );
l_pClient->Release();
return 0;
}
p7.lib(ClBaical.obj):-1: ошибка: LNK2019: ссылка на неразрешенный внешний символ __WSAFDIsSet в функции "public: enum eSocket_Status __cdecl CUDP_Socket::Is_Ready(enum eFD_Type,unsigned int)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]).
p7.lib(ClText.obj):-1: ошибка: LNK2001: неразрешенный внешний символ __imp_bind.
Answer the question
In order to leave comments, you need to log in
In addition to linking a lib, you also need to link its dependencies.
__WSAFDIsSet for example here https://docs.microsoft.com/en-us/windows/win32/api...
LIBS += -lWs2_32
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question