Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. adding dependencies to QT Project
Forum Updated to NodeBB v4.3 + New Features

adding dependencies to QT Project

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Christian EhrlicherC Christian Ehrlicher

    You have to include the correct header where the function is defined. Has nothing to do with linking later on.

    S Offline
    S Offline
    sm2770s
    wrote on last edited by
    #3

    @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?

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Since when do you add include files to the INCLUDE path?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply
      0
      • S sm2770s

        @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?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #5

        @sm2770s
        The error is an undefined function call while compiling. @Christian-Ehrlicher is talking about you requiring the necessary #include statement in your source file.

        1 Reply Last reply
        2
        • Christian EhrlicherC Christian Ehrlicher

          Since when do you add include files to the INCLUDE path?

          S Offline
          S Offline
          sm2770s
          wrote on last edited by sm2770s
          #6

          @Christian-Ehrlicher Sorry for not getting you.
          This is my .pro file

          
          QT       += 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 :-(

          JonBJ 1 Reply Last reply
          0
          • S sm2770s

            @Christian-Ehrlicher Sorry for not getting you.
            This is my .pro file

            
            QT       += 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 :-(

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #7

            @sm2770s
            Your reply has just crossed with mine above.

            S 1 Reply Last reply
            1
            • JonBJ JonB

              @sm2770s
              Your reply has just crossed with mine above.

              S Offline
              S Offline
              sm2770s
              wrote on last edited by sm2770s
              #8

              @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
              
              JonBJ 1 Reply Last reply
              0
              • S sm2770s

                @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
                
                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #9

                @sm2770s
                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.

                S 1 Reply Last reply
                0
                • JonBJ JonB

                  @sm2770s
                  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.

                  S Offline
                  S Offline
                  sm2770s
                  wrote on last edited by sm2770s
                  #10

                  @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.

                  JonBJ 1 Reply Last reply
                  0
                  • S sm2770s

                    @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.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #11

                    @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.

                    S 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @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.

                      S Offline
                      S Offline
                      sm2770s
                      wrote on last edited by
                      #12

                      @JonB Ya! The error shouldnt go but i dont know what happened. I will close this issue as of now and this weekend i will try to reproduce then will update my comment later.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved