I am trying to compile an application and I have added these lines in CMakeLists.txt
option(DISPLAY "Display images and steps" OFF)
option(TESTS "Build tests too" OFF)
if (DISPLAY)
set(CMAKE_CXX_FLAGS "-g -Wall -std=gnu++11 -DDISPLAY_IMGS")
else()
set(CMAKE_CXX_FLAGS "-g -Wall -std=gnu++11")
endif()
(the lines are at the beginning of the file) I am getting an error like this:
In function ‘int main(int, char**)’:
error: in C++98 ‘featuresTypes’ must be initialized by constructor, not by ‘{...}’
Can anyone tell me why it is doing it? In fact building it in KDevelop
works fine, but building it in terminal ($ cmake ..
and $ make
), it gives that error.
VERBOSE=1
says:
/usr/bin/cmake -H/home/xxx/proj/prj1 -B/home/xxx/proj/prj1/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/xxx/proj/prj1/build/CMakeFiles /home/xxx/proj/prj1/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/xxx/proj/prj1/build'
make -f CMakeFiles/prj1.dir/build.make CMakeFiles/prj1.dir/depend
make[2]: Entering directory `/home/xxx/proj/prj1/build'
cd /home/xxx/proj/prj1/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/xxx/proj/prj1 /home/xxx/proj/prj1 /home/xxx/proj/prj1/build /home/xxx/proj/prj1/build /home/xxx/proj/prj1/build/CMakeFiles/prj1.dir/DependInfo.cmake --color=
Dependee "/home/xxx/proj/prj1/build/CMakeFiles/optimisation.dir/DependInfo.cmake" is newer than depender "/home/xxx/proj/prj1/build/CMakeFiles/prj1.dir/depend.internal".
Dependee "/home/xxx/proj/prj1/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/xxx/proj/prj1/build/CMakeFiles/prj1.dir/depend.internal".
Scanning dependencies of target optimisation
make[2]: Leaving directory `/home/xxx/proj/prj1/build'
make -f CMakeFiles/optimisation.dir/build.make CMakeFiles/prj1.dir/build
make[2]: Entering directory `/home/xxx/proj/prj1/build'
/usr/bin/cmake -E cmake_progress_report /home/xxx/proj/prj1/build/CMakeFiles 1
[ 12%] Building CXX object CMakeFiles/prj1.dir/src/cpp/main.cpp.o
/usr/bin/c++ -I/usr/local/include/opencv -I/usr/local/include -I/home/xxx/proj/prj1/src/hpp -o CMakeFiles/prj1.dir/src/cpp/main.cpp.o -c /home/xxx/proj/prj1/src/cpp/main.cpp
/home/xxx/proj/prj1/src/cpp/main.cpp: In function ‘int main(int, char**)’:
/home/xxx/proj/prj1/src/cpp/main.cpp:99:33: error: in C++98 ‘featuresTypes’ must be initialized by constructor, not by ‘{...}’
What it should do instead?