Jump to content

CLion additional include directories?

Hey guys I'm trying to learn how opengl works through C++ and am following a tutorial on youtube.

@ 7:03 ish he says to add an additional include directory, how would I do this in CLion? It uses CMake and I'm using it with MinGW

 

I'm not familiar with cmake but I would guess that I would have to add something to CMakeLists.txt

Link to comment
https://linustechtips.com/topic/465681-clion-additional-include-directories/
Share on other sites

Link to post
Share on other sites

Hey guys I'm trying to learn how opengl works through C++ and am following a tutorial on youtube.

@ 7:03 ish he says to add an additional include directory, how would I do this in CLion? It uses CMake and I'm using it with MinGW

 

I'm not familiar with cmake but I would guess that I would have to add something to CMakeLists.txt

lol i would like to help you but im only starting coding with JavaScript xD

Link to post
Share on other sites

You need to add linker commands to your CMake file.

Clion doesnt have its own build system but just uses CMake (which is fine because its compatible with every OS and is not bound to one IDE).

Have a look at the tutorial:

https://cmake.org/cmake-tutorial/

 

Since your working on Windows anyways why dont you just use Visual Studio so you can follow along with the tutorial?

The community edition is free:

https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx

 

BTW: Bennys guides/tutorial is really good. He also has a really long series on making a game engine in Java and an advanced graphics tutorial (with stuff like shadow mapping).

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to post
Share on other sites

You need to add linker commands to your CMake file.

Clion doesnt have its own build system but just uses CMake (which is fine because its compatible with every OS and is not bound to one IDE).

Have a look at the tutorial:

https://cmake.org/cmake-tutorial/

 

Since your working on Windows anyways why dont you just use Visual Studio so you can follow along with the tutorial?

The community edition is free:

https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx

 

BTW: Bennys guides/tutorial is really good. He also has a really long series on making a game engine in Java and an advanced graphics tutorial (with stuff like shadow mapping).

So...

include_directories(./include)

add_library(glew32.lib glew32s.lib SDL2.lib SDL2main.lib SDL2test.lib OpenGL32.lib)

? I'm getting errors with the second line, I can use #include <GL/glew.h> so the first statement seems to work

Link to post
Share on other sites

So...

include_directories(./include)

add_library(glew32.lib glew32s.lib SDL2.lib SDL2main.lib SDL2test.lib OpenGL32.lib)

? I'm getting errors with the second line, I can use #include <GL/glew.h> so the first statement seems to work

Have a look at:

https://cmake.org/cmake-tutorial/

 

Googling gave me something like this:

link_libraries(glew32.lib SDL2.lib OpenGL32.lib)

 

But somewhere else i found this:

link_directories(./lib)

target_link_libraries(PROJECT_NAME glew32.lib SDL2.lib OpenGL32.lib).

 

I believe i got this working one time but i stopped using Clion/Cmake because Clion was super instable (1.2GB in idle and crashed every few minutes).

 

Any particular reason not to use visual studio (cross platform stuff?)

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to post
Share on other sites

Have a look at:

https://cmake.org/cmake-tutorial/

 

Googling gave me something like this:

link_libraries(glew32.lib SDL2.lib OpenGL32.lib)

 

But somewhere else i found this:

link_directories(./lib)

target_link_libraries(PROJECT_NAME glew32.lib SDL2.lib OpenGL32.lib).

 

I believe i got this working one time but i stopped using Clion/Cmake because Clion was super instable (1.2GB in idle and crashed every few minutes).

 

Any particular reason not to use visual studio (cross platform stuff?)

I've always just liked jetbrains stuff and I have the professional version from a student discount. Visual studio is super cluttered and kind of gets in my way. Cross platform is important too though

Link to post
Share on other sites

I added

link_directories(./include)

target_link_libraries(opengl glew32.lib glew32s.lib SDL2.lib SDL2main.lib SDL2test.lib OpenGL32.lib)

 

But I'm getting a lot of errors

 

7RRFA10.png?1

Your class should be called Display not display, you forgot the capital D.

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to post
Share on other sites

Your class should be called Display not display, you forgot the capital D.

Wow... don't know how I missed that thanks everything seems to work fine now. Also I realized the -'s should be ~'s

 

include_directories(./include)

link_libraries(opengl glew32.lib glew32s.lib SDL2.lib SDL2main.lib SDL2test.lib OpenGL32.lib)

Seems to work

 

Well nevermind, the first seems to work

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×