10 comments
Comment actions Permalink

Please use include_directories command in your CMakeLists.txt. Please find out more in our web help: https://www.jetbrains.com/help/clion/2016.3/quick-cmake-tutorial.html.

0
Comment actions Permalink

Please use the following command in your CMakeLists.txt:

include_directories(<path_to_the_folder_where_your_header_is>)

and reload CMake after that.

0
Comment actions Permalink

When you say "path", I suppose you don't mean "C:\MinGW\include\graphics"? Because apparently the backslashes are creating a problem in CMake.txt.

 

0
Comment actions Permalink

@Canestis please use double backslashes, like this:

include_directories("C:\\MinGW\\include\\graphics")
1
Comment actions Permalink

@Anna Falevskaya Many thanks! The library is now included! However another problem came up.

When I try to compile a code, which is 100% correct and working on other systems and/or IDEs, these errors show up (look at attachment). Any ideas?

0
Comment actions Permalink

@Canestis I assume you need to include a related library to your project. Please try adding the following line in the CMakeLists.txt file after add_executable() command:

target_link_libraries (<target_name> <path_to_the_folder_where_the_library_is>)
0
Comment actions Permalink

Anna Falevskaya I tried doing this as you said, but it still gives me an error.

 

See attached

1
Comment actions Permalink

Iceman1337

  1. Change add_executable(main.cpp) to add_executable(Graphics main.cpp).
  2. Change your target_link_libraries(...) command to target_link_libraries(Graphics "D:\\JetBrains\\CLion\\MinGW\\mingw32\\lib\\libbgi.a") (assuming that you're sure that this library is the one you need)

And please read https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html.

1
Comment actions Permalink

Anna Falevskaya

 

tried that, still not working.

1
Comment actions Permalink

Iceman1337 for some reason CMake can't link your libbgi.a library. I'd suggest checking whether it actually exists in the specified path.

Please note that these kind of questions are out of scope of CLion support, since they are just regular CMake issues not related to CLion.

0

Please sign in to leave a comment.