Toronto Andrew | 3 Aug 2012 20:31
Picon

CMake does not find an header file, and ignores the classes found in several other header files.

The following is my CMakeLists file:

PROJECT(CppSampleQt01)
FIND_PACKAGE(Qt4 REQUIRED)

FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)

SET(CppSampleQt01_SOURCES include/lv.simplon.class.cpp camera.cpp main.cpp
mainwindow.cpp osdep.cpp paint.cpp)
SET(CppSampleQt01_HEADERS include/lv.simplon.class.h camera.h mainwindow.h
osdep.h paint.h)
SET(CppSampleQt01_RESOURCES icons.qrc)

SET(QExtSerialPort_HEADERS QExtSerialPort/src/qextwineventnotifier_p.h 
						QExtSerialPort/src/qextserialport_p.h 
						QExtSerialPort/src/qextserialport_global.h 
						QExtSerialPort/src/qextserialport.h 
						QExtSerialPort/src/qextserialenumerator_p.h 
						QExtSerialPort/src/qextserialenumerator.h)
SET(QExtSerialPort_SOURCES QExtSerialPort/src/qextserialenumerator.cpp
					QExtSerialPort/src/qextserialport.cpp
					QExtSerialPort/src/qextwineventnotifier_p.cpp)
					
if (WIN32)
	SET(QExtSerialPort_SOURCES ${QExtSerialPort_SOURCES}
QExtSerialPort/src/qextserialport_win.cpp)
	#  add_definitions(-DWINVER=0x0501) # needed for mingw (dbt business??
	LINK_LIBRARIES(${QT_QTGUI_LIBRARY} setupapi advapi32 user32)
endif(WIN32)
(Continue reading)

Rolf Eike Beer | 3 Aug 2012 21:14
Picon

Re: CMake does not find an header file, and ignores the classes found in several other header files.

Am Freitag, 3. August 2012, 11:31:44 schrieb Toronto Andrew:
> The following is my CMakeLists file:
> 
> PROJECT(CppSampleQt01)
> FIND_PACKAGE(Qt4 REQUIRED)
> 
> FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
> FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)
> 
> SET(CppSampleQt01_SOURCES include/lv.simplon.class.cpp camera.cpp main.cpp
> mainwindow.cpp osdep.cpp paint.cpp)
> SET(CppSampleQt01_HEADERS include/lv.simplon.class.h camera.h mainwindow.h
> osdep.h paint.h)
> SET(CppSampleQt01_RESOURCES icons.qrc)
> 
> SET(QExtSerialPort_HEADERS QExtSerialPort/src/qextwineventnotifier_p.h
> 						QExtSerialPort/src/qextserialport_p.h
> 						QExtSerialPort/src/qextserialport_global.h
> 						QExtSerialPort/src/qextserialport.h
> 						QExtSerialPort/src/qextserialenumerator_p.h
> 						QExtSerialPort/src/qextserialenumerator.h)
> SET(QExtSerialPort_SOURCES QExtSerialPort/src/qextserialenumerator.cpp
> 					QExtSerialPort/src/qextserialport.cpp
> 					QExtSerialPort/src/qextwineventnotifier_p.cpp)
> 
> if (WIN32)
> 	SET(QExtSerialPort_SOURCES ${QExtSerialPort_SOURCES}
> QExtSerialPort/src/qextserialport_win.cpp)

list(APPEND QExtSerialPort_SOURCES QExtSerialPort/src/qextserialport_win.cpp)
(Continue reading)

Toronto Andrew | 5 Aug 2012 01:58
Picon

Re: CMake does not find an header file, and ignores the classes found in several other header files.

Hello, thank you for looking at my CMake issues! I really appreciate it :)

I fixed the major issue you mentioned (Moving INCLUDE_DIRECTORIES above
ADD_EXECUTABLE), however this did not seem to fix anything. I still got the
errors I was receiving prior to that change, and I used absolute paths when
linking to the include directory within my source. 

I fixed this *qextserialport\src\moc_qextserialport.cpp(10): fatal error
C1083: Cannot open include file: '../../../src/qextserialport.h': No such
file or directory. * by linking to the absolute path in
moc_qextserialport.cpp, which seemed to get rid of it, however it draws up
these now: 

*2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2027: use
of undefined type 'QextSerialPortPrivate'
2>  QExtSerialPort/src/qextserialport.h(167) : see declaration of
'QextSerialPortPrivate'
2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2227: left
of '->_q_canRead' must point to class/struct/union/generic type*

All these errors stem from a class in qextserialport_p.h (Recall:
QExtSerialPort/src/qextserialport_p.h(0): Note: No relevant classes found.
No output generated. still shows up),

So I guess the question is still how do I get the compiler to read these
files? And why is it not reading them? 

This is how the CMakeLists.txt file looks as it is right now:

*PROJECT(CppSampleQt01)
(Continue reading)

Rolf Eike Beer | 5 Aug 2012 11:24
Picon

Re: CMake does not find an header file, and ignores the classes found in several other header files.

Toronto Andrew wrote:
> Hello, thank you for looking at my CMake issues! I really appreciate it :)
> 
> I fixed the major issue you mentioned (Moving INCLUDE_DIRECTORIES above
> ADD_EXECUTABLE), however this did not seem to fix anything. I still got the
> errors I was receiving prior to that change, and I used absolute paths when
> linking to the include directory within my source.
> 
> I fixed this *qextserialport\src\moc_qextserialport.cpp(10): fatal error
> C1083: Cannot open include file: '../../../src/qextserialport.h': No such
> file or directory. * by linking to the absolute path in
> moc_qextserialport.cpp, which seemed to get rid of it, however it draws up
> these now:
> 
> *2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2027: use
> of undefined type 'QextSerialPortPrivate'
> 2>  QExtSerialPort/src/qextserialport.h(167) : see declaration of
> 'QextSerialPortPrivate'
> 2>build\x\QExtSerialPort\src\moc_qextserialport.cxx(97): error C2227: left
> of '->_q_canRead' must point to class/struct/union/generic type*

From the filename I would expect the class to be named QExtSerialPortPrivate 
(i.e. capital first E).

Sometimes it gets tricky to get the includes for the moc files right. One way 
to prevent this is to include the moc file explicitely at the end of the cpp 
file, i.e. #include "moc_qextserialport.cpp"

Eike
--

-- 
(Continue reading)

Toronto Andrew | 6 Aug 2012 02:13
Picon

Re: CMake does not find an header file, and ignores the classes found in several other header files.

Roike! I finally got it to run with a bit of manual linker error fixing!

I`ve one more question though: 

CMake Warning at CMakeLists.txt:51 (ADD_EXECUTABLE):
  Cannot generate a safe linker search path for target CppSampleQt01 because
  there is a cycle in the constraint graph:

    dir 0 is [-DEIGEN_USE_NEW_STDVECTOR]
    dir 1 is [-DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET]
    dir 2 is [-DBOOST_ALL_NO_LIB]
    dir 3 is [-DFLANN_STATIC]
    dir 4 is [ /arch:SSE2]
    dir 5 is [C:/Qt/lib]
      dir 13 must precede it due to link library [QtOpenGL4.lib]
    dir 6 is [C:/Program Files (x86)/PCL 1.6.0/3rdParty/Boost/lib]
    dir 7 is [C:/Program Files (x86)/PCL 1.6.0/lib]
    dir 8 is [C:/Program Files (x86)/OpenNI/Lib]
    dir 9 is [C:/Program Files (x86)/PCL 1.6.0/3rdParty/VTK/lib/vtk-5.8]
    dir 10 is [C:/Program Files (x86)/PCL 1.6.0/3rdParty/FLANN/lib]
    dir 11 is [C:/Program Files (x86)/PCL 1.6.0/3rdParty/Qhull/lib]
    dir 12 is [C:/SimplonSample2/lib]
    dir 13 is [C:/Qt/4.8.0/lib]
      dir 5 must precede it due to link library [QtGui4.lib]

  Some of these libraries may not be found correctly.

CMake Warning at CMakeLists.txt:51 (ADD_EXECUTABLE):
  Cannot generate a safe linker search path for target CppSampleQt01 because
  there is a cycle in the constraint graph:
(Continue reading)

Rolf Eike Beer | 6 Aug 2012 09:21
Picon

Re: CMake does not find an header file, and ignores the classes found in several other header files.

> ADD_DEFINITIONS(${PCL_DEFINITIONS} ${QT_DEFINITIONS})
>
> LINK_DIRECTORIES(${PCL_DEFINITIONS})

This combination is most likely wrong. Adding the same things as 
compiler definitions as well as linker path entries would only be 
correct when the variable is empty.

Also: don't use link_directories(). It's basically always causing 
trouble. Very likely exactly the error you see. If the PCL module does 
not return absolute paths to the libraries you need to link it is broken 
and needs to be fixed.

Eike
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Gmane