EX 1.7 - CMake error

Hello,
In exercise 1.7, when I alter the CMakeLists.txt file as instructed by adding in:

add_executable(simple src/simple.cpp)
add_dependencies(simple ${simple_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(simple
${catkin_LIBRARIES}
)

under ‘build’, I get the following errors upon trying to compile:

user:~/catkin_ws$ catkin_make
Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install

Running command: “make cmake_check_build_system” in “/home/user/catkin_ws/build”

– Using CATKIN_DEVEL_PREFIX: /home/user/catkin_ws/devel
– Using CMAKE_PREFIX_PATH: /home/user/catkin_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
– This workspace overlays: /home/user/catkin_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
– Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.12”, minimum required is"2")
– Using PYTHON_EXECUTABLE: /usr/bin/python2
– Using Debian Python package layout
– Using empy: /usr/bin/empy
– Using CATKIN_ENABLE_TESTING: ON
– Call enable_testing()
– Using CATKIN_TEST_RESULTS_DIR: /home/user/catkin_ws/build/test_results
– Found gmock sources under ‘/usr/src/gmock’: gmock will be built
– Found PythonInterp: /usr/bin/python2 (found version “2.7.12”)
– Found gtest sources under ‘/usr/src/gmock’: gtests will be built
– Using Python nosetests: /usr/local/bin/nosetests-2.7
– catkin 0.7.18
– BUILD_SHARED_LIBS is on
– BUILD_SHARED_LIBS is on
– ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– ~~ traversing 1 packages in topological order:
– ~~ - my_package
– ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– +++ processing catkin package: ‘my_package’
– ==> add_subdirectory(my_package)
– Configuring done
CMake Error at my_package/CMakeLists.txt:151 (add_executable):
Cannot find source file:

src/simple.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx

CMake Error: CMake can not determine linker language for target: simple
CMake Error: Cannot determine link language for target “simple”.
– Generating done
– Build files have been written to: /home/user/catkin_ws/build
Makefile:542: recipe for target ‘cmake_check_build_system’ failed
make: *** [cmake_check_build_system] Error 1
Invoking “make cmake_check_build_system” failed

My file is named simple.cpp and is within the src directory so I am unsure why it can’t be found.

Thanks

Hello @joecostello1998,

First of all, sorry for the late response. Did you solve this issue? If not, please send me the package to my mail (aezquerro@theconstructsim.com) so that I can have a look at it.

Best,