NeoMopp
Posts: 7
Joined: Fri Mar 08, 2013 10:25 am

Unable to link header file with CMakeLists

Fri Jan 17, 2014 1:47 pm

Hello their community,

I'm not sure if this is the correct place to post this but here goes, I am currently working towards a functional face detection system using the raspberry pi's camera board and I am having trouble linking some of my files together with CMakeLists.txt

I have used Emil Valkov's work on the picam api, found here: https://robidouille.wordpress.com/2013/ ... th-opencv/

And I am trying to link this with a little C++ code I've written. I'm trying to do this with cmake but I keep generating an error informing me that the header "RaspiCamCV.h" is missing. Below is my CMakeLists.txt file, where I suspect the error is being caused. Can anyone point out the error, although I suspect i've just not written the file correctly...

Code: Select all

cmake_minimum_required(VERSION 2.8)
project(emobot_eyes)

find_package(OpenCV REQUIRED)

include_directories(include home/pi/git/robidouille/raspicam_cv)

link_directories(~/git/emobot/libfacerec0.04)

add_executable(emobot_eyes main.cpp)
target_link_libraries(emobot_eyes  ${OpenCV_LIBS})
target_link_libraries(emobot_eyes home/pi/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -l mmal_util -lvcos -lbcm_host)
target_link_libraries(emobot_eyes home/pi/git/robidouille/raspicam_cv)
I also provide a link to my git with the project in full https://github.com/NeoMopp/emobot/blob/ ... g/main.cpp
Thank you to anyone who provides assistance

sedonami
Posts: 17
Joined: Wed Jan 08, 2014 5:20 pm

Re: Unable to link header file with CMakeLists

Fri Jan 17, 2014 5:42 pm

What happens when you provide the VERBOSE=1 flag to make? It should give you better debugging output which should indicate what include/link paths are being passed to the compiler.

NeoMopp
Posts: 7
Joined: Fri Mar 08, 2013 10:25 am

Re: Unable to link header file with CMakeLists

Fri Jan 17, 2014 7:06 pm

Tried as you suggest this is the result:

Code: Select all

/usr/bin/cmake -H/home/pi/git/emobot/core_prog -B/home/pi/git/emobot/core_prog -                                                                                                                                            -check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/pi/git/emobot/core_prog/CMakeFiles                                                                                                                                                              /home/pi/git/emobot/core_prog/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/pi/git/emobot/core_prog'
make -f CMakeFiles/emobot_eyes.dir/build.make CMakeFiles/emobot_eyes.dir/depend
make[2]: Entering directory `/home/pi/git/emobot/core_prog'
cd /home/pi/git/emobot/core_prog && /usr/bin/cmake -E cmake_depends "Unix Makefi                                                                                                                                                             les" /home/pi/git/emobot/core_prog /home/pi/git/emobot/core_prog /home/pi/git/em                                                                                                                                                             obot/core_prog /home/pi/git/emobot/core_prog /home/pi/git/emobot/core_prog/CMake                                                                                                                                                             Files/emobot_eyes.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/pi/git/emobot/core_prog'
make -f CMakeFiles/emobot_eyes.dir/build.make CMakeFiles/emobot_eyes.dir/build
make[2]: Entering directory `/home/pi/git/emobot/core_prog'
/usr/bin/cmake -E cmake_progress_report /home/pi/git/emobot/core_prog/CMakeFiles                                                                                                                                                              1
[100%] Building CXX object CMakeFiles/emobot_eyes.dir/main.cpp.o
/usr/bin/c++    -I/usr/include/opencv -I/home/pi/git/emobot/core_prog/include -I                                                                                                                                                             /home/pi/git/emobot/core_prog/home/pi/git/robidouille/raspicam_cv    -o CMakeFil                                                                                                                                                             es/emobot_eyes.dir/main.cpp.o -c /home/pi/git/emobot/core_prog/main.cpp
/home/pi/git/emobot/core_prog/main.cpp:11:36: fatal error: raspicam_cv/RaspiCamC                                                                                                                                                             V.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/emobot_eyes.dir/main.cpp.o] Error 1
make[2]: Leaving directory `/home/pi/git/emobot/core_prog'
make[1]: *** [CMakeFiles/emobot_eyes.dir/all] Error 2
make[1]: Leaving directory `/home/pi/git/emobot/core_prog'
make: *** [all] Error 2
Shame I don't understand this....

frodo
Posts: 63
Joined: Wed Dec 18, 2013 2:36 pm

Re: Unable to link header file with CMakeLists

Fri Jan 17, 2014 9:09 pm

You seem to mix absolute(1) and relative pathnames(2).
Are you sure you really want to do this?

What is the code in '/home/pi/git/emobot/core_prog/main.cpp:11:36'?

What is the output of 'find /home -name RaspiCamCV.h'?

(1)
/usr/bin/cmake -H/home/pi/git/emobot/core_prog -B/home/pi/git/emobot/core_prog

(2)
include_directories(include home/pi/git/robidouille/raspicam_cv)

NeoMopp
Posts: 7
Joined: Fri Mar 08, 2013 10:25 am

Re: Unable to link header file with CMakeLists

Fri Jan 17, 2014 11:52 pm

I have resolved this particular issue, I failed to add the header file to the executable command. The following is what I should have provided.
add_executable(emobot_eyes main.cpp home/pi/git/robidouille/raspicam_cv/RaspiCamCV.h)
Thanks to all that tried to assist. Now to fix the new errors!

Return to “C/C++”