adding dependencies to QT Project
-
You have to include the correct header where the function is defined. Has nothing to do with linking later on.
-
@Christian-Ehrlicher Hi Christian. Thanks for your suggestion. To be clear you mean that i need to include those specific headers using INCLUDE in .Pro file?
-
Since when do you add include files to the INCLUDE path?
-
@Christian-Ehrlicher Sorry for not getting you.
This is my .pro fileQT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = Something TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 INCLUDEPATH += C:\TestRepos\Rep_Test\libs\eigen\include\eigen3\Eigen LIBS += -lwsock32 LIBS += -lws2_32 LIBS += -lkernel32 -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 SOURCES += \ main.cpp \ widget.cpp \ source1.cpp \ source2.cpp \ source3.cpp \ source4.cpp HEADERS += \ widget.h \ head1.h \ head2.h \ head3.hpp \ head4.hpp \ head5.hpp FORMS += \ widget.ui RESOURCES += \ resource.qrc
I am not getting what you are saying. Sorry for being dumb :-(
-
@JonB . I think i already added necessary include statement in source file where i am having Problems. I am not sure if you are saying this :-). But I will also go through code and needed documentaion once. Thanks for giving some insights will do some homework on it then comeback again and will update solution if i found one.
#include "head2.h" #include <cstdlib> #include <cstdio> #include <cstring> #if defined(_WIN32) || defined(WIN32) || defined(_WIN64) #define OS_WIN #else #define OS_UNIX #endif #ifdef OS_UNIX #include <unistd.h> #include <netdb.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h> #endif #ifdef OS_WIN #include <ws2tcpip.h> #include <winsock2.h> #include <windows.h> #endif
-
@sm2770s
Either your reference toinet_pton
lies in some file other than the one you show, or you should read e.g. https://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found and compare the answers there to your exact situation (e.g. check yourWINVER
). Actually, I believe the accepted solution there might be saying you need#include <arpa/inet.h>
, even though you are Windows not Linux, but have a read and see what you think. -
@JonB said in adding dependencies to QT Project:
Either your reference to inet_pton lies in some file other than the one you show, or you should read e.g. https://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found and compare the answers there to your exact situation (e.g. check your WINVER). Actually, I believe the accepted solution there might be saying you need #include <arpa/inet.h>, even though you are Windows not Linux, but have a read and see what you think.
Hi Jon! I am not sure but it was built successfully when i restarted my system. I am clueless what happened but it worked when i restarted. Even I tried to reproduce the error but till now not successful in reproducing error again.
-
@sm2770s
Well this really isn't an error message which should appear/disappear on system restart!Anyway, yes, mark topic as solved (either from Topic Tools at bottom, or mark your own reply post above as the "solution"). You can always re-open it if it occurs again soon.