My CMakeList file defined a list of directory that should be included in the build path:
set(CMAKE_CXX_STANDARD 11)
include_directories(lib)
include_directories(lib/freeglut)
include_directories(lib/freeglut/include)
include_directories(lib/freeglut/include/GL)
include_directories(lib/matrix)
include_directories(lib/mavlink)
include_directories(lib/mavlink/common)
include_directories(src)
include_directories(src/Drawing)
include_directories(src/Math)
include_directories(src/MavlinkNode)
include_directories(src/Simulation)
include_directories(src/Utility)
...
all dependent files are under /lib. When I run CMake CMakeList.txt & make
, I got the following error:
[100%] Linking CXX executable FCND_Controls_CPP
CMakeFiles/FCND_Controls_CPP.dir/src/main.cpp.o: In function `main':
/home/peng/git-drone/__Udacity__/FCND-Controls-CPP/src/main.cpp:68: undefined reference to `glutTimerFunc'
/home/peng/git-drone/__Udacity__/FCND-Controls-CPP/src/main.cpp:70: undefined reference to `glutMainLoop'
...
While both functions glutTimerFunc and glutMainLoop are under 'lib/freeglut/include/GL/freeglut.h'. Yet either CMake and make is ignoring them. Why this could happen and what should I do to fix them?
I'm using cmake 3.9.1, I've tried 2 backends: gcc/g++ and clang/clang++ and both gave the same error.