CLion "Creating an unknown structure without a link" but compiles fine

I am trying to set up my cmake project with HDF5 on Windows 10 (64 bit) using the CLion editor and MinGW. After a ton of time, trying to properly configure the CMakeLists file, I got something working - the code is compiling, there are no errors from mingw32-make or from cmake. However, I still get red underlined errors in CLion that do not seem to affect the assembly, but I feel that they are there because I did something wrong. (I'm very new, doing something more than cool C ++ projects)

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

project(testProject)
add_definitions(-std=c++11)
set(SOURCE_FILES hdf_example.cpp)

link_libraries("C:/Program Files/HDF_Group/HDF5/1.8.16/lib/hdf5_hl_cpp-shared.lib"
               "C:/Program Files/HDF_Group/HDF5/1.8.16/lib/hdf5_cpp-shared.lib"
               "C:/Program Files/HDF_Group/HDF5/1.8.16/lib/hdf5-shared.lib")

add_executable (abc hdf_example.cpp)

enter image description here

Compiling from the command line using the mingw32-make command or in the IDE results in successful compilation without errors or warnings that I can see.

C:\Users\Me\Documents\project_name\temp-build\src\abc>mingw32-make
[ 50%] Building CXX object src/s3/CMakeFiles/abc.dir/hdf_example.cpp.obj
[100%] Linking CXX executable abc.exe
[100%] Built target abc

-, ? , ?

+4
3

, #include <getopt.h> #include <unistd.h> C. CLion. issue. .

.

enter image description here

+5

IDE - "" . , Cmake MingW. , IDE , CMakeLists. hdf5 ++ , "" IDE. .

+3

I also ran into this error, and it turned out that in my case, I actually forgot to include the header. Using Emacs, the correct error information ( Implicit instantiation of undefined template 'std::basic_ifstream<char,std::char_traits<char>>') is displayed (see Why am I getting this ifstream error? ). I'm not sure why CLION reported the error incorrectly.

0
source

Source: https://habr.com/ru/post/1626075/


All Articles