Author Topic: Adding include directory  (Read 1586 times)

Offline Kaz

  • Single posting newcomer
  • *
  • Posts: 6
Adding include directory
« on: May 11, 2021, 04:02:37 pm »
Hello,

I want to enable the line 2 in the photo

Code
#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?

Offline gd_on

  • Lives here!
  • ****
  • Posts: 656
Re: Adding include directory
« Reply #1 on: May 11, 2021, 04:16:22 pm »
I think you should write
Code
#include "glad/gl.h"
<> is normally reserved for standard compiler paths.
« Last Edit: May 11, 2021, 04:18:25 pm by gd_on »
Windows 10 64 bits (21H1), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 10.3.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7150
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7150
    • My Best Post
Re: Adding include directory
« Reply #3 on: May 11, 2021, 04:29:44 pm »
I think you should write
Code
#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++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Kaz

  • Single posting newcomer
  • *
  • Posts: 6
Re: Adding include directory
« Reply #4 on: May 11, 2021, 04:41:00 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7150
    • My Best Post
Re: Adding include directory
« Reply #5 on: May 11, 2021, 04:48:58 pm »
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.
« Last Edit: May 11, 2021, 04:53:39 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13405
    • Travis build status
Re: Adding include directory
« Reply #6 on: May 11, 2021, 04:53:59 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!]

Offline Kaz

  • Single posting newcomer
  • *
  • Posts: 6
Re: Adding include directory
« Reply #7 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?...



-------------- 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))
 

Offline gd_on

  • Lives here!
  • ****
  • Posts: 656
Re: Adding include directory
« Reply #8 on: May 11, 2021, 05:35:20 pm »
If you simply right click on the line containing #include "glad/gl.h", you should see a popup with open 'glad/gl.h'
Windows 10 64 bits (21H1), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 10.3.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).

Offline Kaz

  • Single posting newcomer
  • *
  • Posts: 6
Re: Adding include directory
« Reply #9 on: May 12, 2021, 12:30:40 pm »
Quote
If 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.

Offline gaiusbonus

  • Single posting newcomer
  • *
  • Posts: 7
Re: Adding include directory
« Reply #10 on: May 12, 2021, 12:43:01 pm »
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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13405
    • Travis build status
Re: Adding include directory
« Reply #11 on: May 12, 2021, 01:18:55 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!]

Offline gaiusbonus

  • Single posting newcomer
  • *
  • Posts: 7
Re: Adding include directory
« Reply #12 on: May 12, 2021, 01:51:52 pm »
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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13405
    • Travis build status
Re: Adding include directory
« Reply #13 on: May 12, 2021, 04:24:46 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!]