Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Problem with Qmake
Forum Updated to NodeBB v4.3 + New Features

Problem with Qmake

Scheduled Pinned Locked Moved Installation and Deployment
9 Posts 4 Posters 6.4k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kevinn
    wrote on last edited by
    #1

    Hi,

    I need to write some code for an application that uses a camera with an gigabit ethernet connection. The company who made the camera has provided header files to read images from the camera. The files are : ImageLib.h , PvApi.h and PvRegIo.h.
    I wrote some code in Snap.cpp and when i compile it this way : @g++-4.4 -Wl,--rpath -Wl,./ -O3 -fno-strict-aliasing -fexceptions -I/usr/include -D_x86 -D_LINUX -Wall -Wno-unused-function pkg-config --cflags opencv -D_REENTRANT Snap.cpp -o Snap -lpthread -lrt -Bdynamic -lm -lc -lPvAPI pkg-config --libs opencv
    @
    Everything works.

    But when i try to put this in an .pro file it won't compile anymore. The reason i want to put this in a .pro file is because the main project has an .pro file so when I succeed in creating a .pro file for this example I can just copy these line into my main project's .pro file to use this code.

    My current .pro file for the example i am trying looks like this :
    @CONFIG += link_pkgconfig
    PKGCONFIG += opencv
    PRECOMPILED_HEADER = ImageLib.h
    PRECOMPILED_HEADER = PvApi.h
    PRECOMPILED_HEADER = PvRegIo.h
    SOURCES += Snap.cpp
    LIBS += -lrt
    LIBS += -Bdynamic
    LIBS += -lm
    LIBS += -lc
    LIBS += -lPvAPI
    TARGET = Snap@

    But when I do "qmake Snap.pro" and then "make" it wont compile.
    Can anyone help plz?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yshurik
      wrote on last edited by
      #2

      What about pkg-config --cflags opencv? This included sub-command definitely add something to command line. And what is compiler error when you use qmake/make?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kevinn
        wrote on last edited by
        #3

        pkg-config —cflags opencv => this lets me use the opencv library. The first two lines in the .pro file does the same. So that works because I already use it in my main .pro file. The problem is that I can't get the library from the camera working. When i compile with the commandline from the first post it works, but with the .pro file i can't get it to work.

        The errors i get when using the .pro file are these:

        @kevin-laptop:~/Bureaublad/Project/robot_vision/Code/cameratest/test$ make

        g++ -c -pipe -O2 -I/usr/local/include/opencv -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o Snap.o Snap.cpp
        In file included from Snap.cpp:48:
        PvApi.h:105:26: error: #error Define PVDECL to be your compiler keyword for "standard call"
        PvApi.h:424:2: error: #error Define specific data types for your platform.
        In file included from Snap.cpp:48:
        PvApi.h:279: error: expected ‘)’ before ‘’ token
        PvApi.h:310: error: expected ‘)’ before ‘
        ’ token
        PvApi.h:405: error: expected ‘)’ before ‘’ token
        PvApi.h:501: error: expected initializer before ‘PvVersion’
        PvApi.h:521: error: expected initializer before ‘PvInitialize’
        PvApi.h:539: error: expected initializer before ‘PvInitializeNoDiscovery’
        PvApi.h:552: error: expected initializer before ‘PvUnInitialize’
        PvApi.h:586: error: expected initializer before ‘PvLinkCallbackRegister’
        PvApi.h:609: error: expected initializer before ‘PvLinkCallbackUnRegister’
        PvApi.h:632: error: ‘PVDECL’ does not name a type
        PvApi.h:654: error: ‘PVDECL’ does not name a type
        PvApi.h:671: error: ‘PVDECL’ does not name a type
        PvApi.h:696: error: expected initializer before ‘PvCameraInfoEx’
        PvApi.h:721: error: expected initializer before ‘PvCameraInfo’
        PvApi.h:751: error: expected initializer before ‘PvCameraInfoByAddrEx’
        PvApi.h:786: error: expected initializer before ‘PvCameraInfoByAddr’
        PvApi.h:810: error: ‘PVDECL’ does not name a type
        PvApi.h:835: error: ‘PVDECL’ does not name a type
        PvApi.h:872: error: expected initializer before ‘PvCameraOpen’
        PvApi.h:909: error: expected initializer before ‘PvCameraOpenByAddr’
        PvApi.h:929: error: expected initializer before ‘PvCameraClose’
        PvApi.h:955: error: expected initializer before ‘PvCameraIpSettingsGet’
        .....
        PvApi.h:1906: error: expected initializer before ‘PvUtilityColorInterpolate’
        Snap.cpp: In function ‘void WaitForCamera()’:
        Snap.cpp:85: error: ‘PvCameraCount’ was not declared in this scope
        Snap.cpp:88: error: ‘Sleep’ was not declared in this scope
        Snap.cpp: In function ‘bool CameraGet(tCamera
        )’:
        Snap.cpp:110: error: ‘tPvUint32’ was not declared in this scope
        Snap.cpp:110: error: expected ‘;’ before ‘count’
        Snap.cpp:113: error: ‘connected’ was not declared in this scope
        Snap.cpp:113: error: ‘PvCameraList’ was not declared in this scope
        Snap.cpp:114: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator==’
        Snap.cpp: In function ‘bool CameraSetup(tCamera*)’:
        Snap.cpp:128: error: ‘PvCameraOpen’ was not declared in this scope
        Snap.cpp: In function ‘bool CameraStart(tCamera*)’:
        Snap.cpp:144: error: ‘PvAttrUint32Get’ was not declared in this scope
        Snap.cpp:162: error: ‘PvCaptureStart’ was not declared in this scope
        Snap.cpp:167: error: ‘PvAttrEnumSet’ was not declared in this scope
        Snap.cpp:173: error: ‘PvCommandRun’ was not declared in this scope
        Snap.cpp:178: error: ‘PvCaptureEnd’ was not declared in this scope
        Snap.cpp: In function ‘void CameraStop(tCamera*)’:
        Snap.cpp:200: error: ‘PvCommandRun’ was not declared in this scope
        Snap.cpp:201: error: ‘PvCaptureEnd’ was not declared in this scope
        Snap.cpp: In function ‘bool CameraSnap(tCamera*)’:
        Snap.cpp:208: error: ‘PvCaptureQueueFrame’ was not declared in this scope
        Snap.cpp:213: error: ‘PvCaptureWaitForFrameDone’ was not declared in this scope
        Snap.cpp: In function ‘void CameraUnsetup(tCamera*)’:
        Snap.cpp:231: error: ‘PvCameraClose’ was not declared in this scope
        Snap.cpp: In function ‘int main(int, char**)’:
        Snap.cpp:314: error: ‘PvInitialize’ was not declared in this scope
        Snap.cpp:355: error: ‘PvUnInitialize’ was not declared in this scope
        Snap.cpp: At global scope:
        Snap.cpp:311: warning: unused parameter ‘argc’
        Snap.cpp:311: warning: unused parameter ‘argv’
        make: *** [Snap.o] Fout 1
        @

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Can you show us the output from these two commands and the contents of your .pro please:

          @
          pkg-config --cflags opencv
          pkg-config --libs opencv
          @

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kevinn
            wrote on last edited by
            #5

            The output of the two commands :
            @
            -I/usr/local/include/opencv
            -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml
            @

            My current .pro file:
            @CONFIG += link_pkgconfig
            PKGCONFIG += opencv
            INCLUDEPATH = ./mantalib
            SOURCES += Snap.cpp
            LIBS += -lrt
            LIBS += -Bdynamic
            LIBS += -lm
            LIBS += -lc
            LIBS += -L./mantalib -lPvAPI
            TARGET = Snap@

            The header files i use to use the camera are in the folder mantalib. So i added INCLUDEPATH = ./mantalib to my .pro file. But it isn't working yet:s

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              I just overlooked this:

              @
              PvApi.h:105:26: error: #error Define PVDECL to be your compiler keyword for "standard call"
              PvApi.h:424:2: error: #error Define specific data types for your platform.
              @

              Looks like you're missing some config defines. Your original stand alone command line contains this define:

              @
              -D_x86 -D_LINUX
              @

              But that's missing from your .pro file. You could try to add this line to the .pro:

              @
              DEFINES += _x86 _LINUX
              @

              This should solve the compilation issues.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kevinn
                wrote on last edited by
                #7

                OMG I think you just made my day ;) Thank you so much!

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  You're welcome - it's so often that it's the small glitches that cost you day of debugging :-)

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kanwariya
                    wrote on last edited by
                    #9

                    Hello There,

                    I am also stuck in similear kind of problem.

                    as you have solved by adding following line to .pro file.

                    DEFINES += _x86 _LINUX

                    please suggest how do i make .pro file of it already exist somewher...?

                    regards

                    kaushal

                    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