INCLUDEPATH in qmake project file doesn't work

前端 未结 12 2100
梦如初夏
梦如初夏 2020-12-06 09:53

I\'ve got a problem with include in a qmake project. In my .pro file I\'ve got:

INCLUDEPATH += \"C:\\OpenCV\\build\\include\"

and in my cpp

12条回答
  •  囚心锁ツ
    2020-12-06 10:29

    I was getting the error:

    canserialcomm.o: In function `CanSerialComm::CanSerialComm()':
    canserialcomm.cpp:(.text+0xc1): undefined reference to `vtable for CanSerialComm'
    

    It turns out that the cause was it wasn't able to find canserialcomm.h where that constructor is declared. This was despite me having INCLUDEPATH in the project file point to the directory containing that header file:

    INCLUDEPATH += . \
            ..
    

    What I had to do to fix this is explicitely specify the header file; I added:

    HEADER += ../canserialcomm.h
    

提交回复
热议问题