I'm encountering an issue during the compilation of my project using CMake. When attempting to build the project, I receive the following error message:
Copy error :
FAILED: CMakeFiles/TestOpencv.dir/main.c.obj
C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\cl.exe /nologo -external:ID:\lilia\Documents\libs\opencv\build\include -external:W0 /DWIN32 /D_WINDOWS /Zi /Ob0 /Od /RTC1 -MDd /showIncludes /FoCMakeFiles\TestOpencv.dir\main.c.obj /FdCMakeFiles\TestOpencv.dir\ /FS -c C:\Users\lilia\CLionProjects\TestOpencv\main.c
D:\lilia\Documents\libs\opencv\build\include\opencv2/core.hpp(49): fatal error C1189: #error: core.hpp header must be compiled as C++
ninja: build stopped: subcommand failed.
I believe this error is related to the inclusion of the core.hpp header file from OpenCV, but I'm uncertain about the exact cause or how to resolve it. I'm using CLion as my development environment and CMake for project configuration.
In attempting to resolve the compilation issue I encountered with my project, I've taken the following steps:
- Dependency check: I verified that all necessary dependencies, including OpenCV, are correctly installed on my system.
- CMake configuration: I carefully reviewed my CMakeLists.txt file to ensure that OpenCV is properly included and configured.
- Compilation options: I checked the compilation options to ensure they're correctly set.
Despite these efforts, I haven't been able to resolve the error. I was expecting the project to compile successfully without encountering the mentioned error related to the core.hpp header file from OpenCV.
Could you please provide guidance on further troubleshooting steps or possible solutions?