Author Topic: Codeblocks CC isn't looking up nested include files.  (Read 6101 times)

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Codeblocks CC isn't looking up nested include files.
« on: September 04, 2007, 02:32:21 pm »
I posted a bug error of this but as I see it sink down on the list I think it just may be something that can be solved simply.

I do OpenGL Programming and use GLFW.  The glfw.h file includes both gl.h and glu.h, but in the recent builds code completion isn't looking beyond the immediate include file for functions.  If I start typing glu... nothing will come up, and if I start typing gl... code completion only returns glfw functions.  How come it is not looking at includes within  includes.  is there  a setting to change this?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Codeblocks CC isn't looking up nested include files.
« Reply #1 on: September 05, 2007, 02:19:00 pm »
is there  a setting to change this?
Possibly you need to adjust the C++ parser options (project options -> tab C++ parser) to include the path to the GL files.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Codeblocks CC isn't looking up nested include files.
« Reply #2 on: September 05, 2007, 02:37:03 pm »
Still not working.  I have the glfw libraries and headers in my mingw lib and include/GL directories respectively and I have mingw/include, and mingw/lib in my project options under search directories and libraries and still am getting the same problem.

[attachment deleted by admin]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Codeblocks CC isn't looking up nested include files.
« Reply #3 on: September 05, 2007, 02:46:06 pm »
Still not working.  I have the glfw libraries and headers in my mingw lib and include/GL directories respectively and I have mingw/include, and mingw/lib in my project options under search directories and libraries and still am getting the same problem.
What happens if you include them anyway before the glfw header include? (Don't forget to save the file to have CC re-parsing.)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Codeblocks CC isn't looking up nested include files.
« Reply #4 on: September 05, 2007, 02:51:17 pm »
What happens if you include them anyway before the glfw header include? (Don't forget to save the file to have CC re-parsing.)
It works for me if I include the header files exactly like this:
Code
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glfw.h"
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Codeblocks CC isn't looking up nested include files.
« Reply #5 on: September 05, 2007, 03:25:36 pm »
That works of course, but the thing is, that's not how it used to work.  Here's a snippet of code from the glfw header
Code
// -------------------- END SYSTEM/COMPILER SPECIFIC ---------------------

// Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is
// convenient for the user to only have to include <GL/glfw.h>. This also
// solves the problem with Windows <GL/gl.h> and <GL/glu.h> needing some
// special defines which normally requires the user to include <windows.h>
// (which is not a nice solution for portable programs).

#if defined(__APPLE_CC__)
 #include <OpenGL/gl.h>
 #include <OpenGL/glu.h>
#else
 #include <GL/gl.h>
 #include <GL/glu.h>
#endif

Shouldn't the CC look into the header and see the included files and parse them appropriately?  I am saying it worked before, but recently I noticed it does not.  I put it up as a big but could hardly explain it as I can here.

Offline Keyla

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Codeblocks CC isn't looking up nested include files.
« Reply #6 on: September 06, 2007, 07:48:44 pm »
I think the thing is that "" and <> are different paths, aren't they?
First one is for absolute paths within you project dir and secondone is for searchpath. Or am I wrong?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Codeblocks CC isn't looking up nested include files.
« Reply #7 on: September 06, 2007, 08:03:40 pm »
Or am I wrong?
No, it also works for me with <>. The reason is another, most likely related to the #define wrapper which cannot be resolved at that point so CC skips this section.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Codeblocks CC isn't looking up nested include files.
« Reply #8 on: September 07, 2007, 12:01:13 am »
Ok, I just modified the glfw header file to comment out the entire header and just put them all local, no sense bothering I guess, but the block was the main problem.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Codeblocks CC isn't looking up nested include files.
« Reply #9 on: September 08, 2007, 08:00:05 pm »
Just as a reference to those interested (and not willing to dig through our svn changelog or code):

Code
#if defined(__APPLE_CC__)
 #include <OpenGL/gl.h>
 #include <OpenGL/glu.h>
#else
 #include <GL/gl.h>
 #include <GL/glu.h>
#endif

The C++ parser in these cases always follows the code inside #if/ifdef/ifndef and skips the #else part. A special case to be considered later is "#if 0" which will force the parser to follow the #else branch instead.
Be patient!
This bug will be fixed soon...