News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Adding include directory

Started by Kaz, May 11, 2021, 04:02:37 PM

Previous topic - Next topic

Kaz

Hello,

I want to enable the line 2 in the photo

#include <glad/gl.h>

by adding the include directory, rather than writing the full path as in the line 1.
And I think I did so, as in the build log, but when I try to open #include file:  'glad/gl.h', I get this warning "Not found".

So can anyone tell me how to do this corrctly?

gd_on

#1
I think you should write
#include "glad/gl.h"
<> is normally reserved for standard compiler paths.
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: gd_on on May 11, 2021, 04:16:22 PM
I think you should write
#include "glad/gl.h"
<> is normally reserved for standard compiler paths.

The above is likely officially true; but, in practice it tends to mean an Compiler or Third Party include when using angle brackets <>.

Tim S. 
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Kaz

Quote from: stahta01 on May 11, 2021, 04:24:35 PM
https://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

WARNING: Use the "For your project :" section of the directions!

Tim S.

I added the path to both for compiler and linker, but unfortunately still can't open the header file.

I also tried replacing "" with <>, which didn't make a difference either.

stahta01

#5
Post the "build log" Do not post the "Build Messages"!

Edit: Add FAQ link https://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

Quote from: stahta01 on May 11, 2021, 04:48:58 PM
Post the "build log" Do not post the "Build Messages"!
Note: Also you can "right click -> copy" instead of posting screen shots :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Kaz

Here is the build log. I've notced that it compiles without errors, but it's just that I can't open the header filefrom code blocks unless I write the full path. Does this mean that it's no problem apart from the inconvenience?...



-------------- Build: Debug in 10MayTest (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -I/home/kazuya/vcpkg/buildtrees/glfw3/src/3.3.3-47325b0495.clean/deps/ -c /home/kazuya/Documents/10MayTest/main.cpp -o obj/Debug/main.o
g++ -L/home/kazuya/vcpkg/buildtrees/glfw3/src/3.3.3-47325b0495.clean/deps/ -o bin/Debug/10MayTest obj/Debug/main.o   
Output file is bin/Debug/10MayTest with size 91.13 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

gd_on

If you simply right click on the line containing #include "glad/gl.h", you should see a popup with open 'glad/gl.h'
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Kaz

QuoteIf you simply right click on the line containing #include "glad/gl.h", you should see a popup with open 'glad/gl.h'

Somehow it doesn't work, to repeat myself, unless I type with the full path.
However, now I've realised that this might be just slight inconvenience with no serious consequences, so I'd like to leave this for now.

Thank you very much for the answers, though.

gaiusbonus

did you add a path to compilers serach directories?

In the project build options you have to add the search directory like this:
../../yourLocalPathToGlad/glad/include
Linux Mint 20.1 | code::blocks 20.03 | g++ 9.3.0-17ubuntu1~20.04

oBFusCATed

Quote from: Kaz on May 11, 2021, 05:24:58 PM
Here is the build log. I've notced that it compiles without errors, but it's just that I can't open the header filefrom code blocks unless I write the full path. Does this mean that it's no problem apart from the inconvenience?...
It is a bug if you've set the search path in the project -> build options -> search directories.
Where exactly have you added the path?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gaiusbonus

What do you mean with "It is a bug"? A mistake?
There may be other ways to get to Rome but this is the one I use successfully.
If I remember right, I used a book from Joey de Vries when I startet with openGL and did it the same way since then.
Linux Mint 20.1 | code::blocks 20.03 | g++ 9.3.0-17ubuntu1~20.04

oBFusCATed

Quote from: gaiusbonus on May 12, 2021, 01:51:52 PM
What do you mean with "It is a bug"? A mistake?
I mean that if the "open include file" feature of the IDE doesn't work, but compilation from the IDE works, then it is most probably a bug in the IDE and it should be possible to fix it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]