Compiling CMakeCXXCompilerId.cpp and CMakeCCompilerId.c files failed error in CMakeLists.txt file while configuring OpenCV with CMake
Asked Answered
D

0

0

I am doing object detection in images using OpenCV library in Eclipse java. For this I need to create a .vec file using opencv_createsamples utility in command prompt but opencv_createsamples is not getting recognized in Dos prompt.

So I need to configure opencv enabled with TBB with CMake but getting compilation error in CMakeCCompilerId.c and CMakeCXXCompilerId.cpp files in CMakeLists.txt file.

Am I missing something?

Dogmatize answered 16/9, 2015 at 6:38 Comment(7)
Welcome to StackOverflow. This error message normally just means that CMake was unable to compile a simple test program (one of the first things CMake tries while detecting your build environment). Could you please add the complete error message to your question (because the reason for the error is most likely also in the message) and please add the command line CMake call you are trying also? General speaking you probably don't have the compiler environment set (see e.g. Why does Cmake Always Choose GCC?).Annadiane
Thanks Florian. To resolve this error I downloaded these two files and copied them in source folder of opencv.Dogmatize
But now I am getting another error. The CXX compiler identification is unknown The C compiler identification is unknown CMake Error at CMakeLists.txt:88 (project): No CMAKE_CXX_COMPILER could be found. CMake Error at CMakeLists.txt:88 (project): No CMAKE_C_COMPILER could be found. Configuring incomplete, errors occurred! See also "C:/opencv/build/CMakeFiles/CMakeOutput.log". See also "C:/opencv/build/CMakeFiles/CMakeError.log".Dogmatize
If we are talking about CMakeCCompilerId.c and CMakeCXXCompilerId.cpp, those are generated by CMake to test/find the compiler. So no need to download them. Your error message says, CMake can't find your C/CXX compiler. What OS and compiler toolchain are you targeting? Does your compiler work outside CMake if called directly? If e.g. Linux and GNU what does happen if you call gcc in a bash shell? I get gcc.exe: fatal error: no input files compilation terminated., which is good because it did find gcc and it's complaining that I didn't gave it any parameters to work with.Annadiane
And please take a look at CMakeError.log. There you will find what CMake tried to call.Annadiane
Duplicate to How to use OpenCv utilities in Command promptAnnadiane
After 4 years. I am having the same issue. the error message CMAKE_CXX_COMPILER could not be found` means that it gcc/g++ compiler could not be found. You need to set it as -DCMAKE_CXX_COMPILER=C:/Rtools/mingw_64/bin/g++.exeCaretaker

© 2022 - 2024 — McMap. All rights reserved.