User forums > Using Code::Blocks
Adding not-included header files to code completition
(1/1)
aXyde:
Hi,
is there a way to add stuff from header files that are not really added inside the code to the code completition feature (the thing when u push strg + space)?
Example: if you use the glut framework you only want to do "#include <GL/glut.h>" and not "#include <GL/gl.h> #include <GL/glu.h>" but I still want to have those GL-functions inside my code completition.
ollydbg:
--- Quote from: aXyde on October 13, 2009, 10:09:13 pm ---Hi,
is there a way to add stuff from header files that are not really added inside the code to the code completition feature (the thing when u push strg + space)?
Example: if you use the glut framework you only want to do "#include <GL/glut.h>" and not "#include <GL/gl.h> #include <GL/glu.h>" but I still want to have those GL-functions inside my code completition.
--- End quote ---
Hi, I'm not sure if GL/glut.h is internally include gl.h and glu.h, if it is true, then all the headers will be automatically parsed by CodeCompletion. That's because CC will do the include file expansion. :D
aXyde:
--- Quote from: ollydbg on October 14, 2009, 03:06:06 am ---Hi, I'm not sure if GL/glut.h is internally include gl.h and glu.h, if it is true, then all the headers will be automatically parsed by CodeCompletion. That's because CC will do the include file expansion. :D
--- End quote ---
Well i'm using some framework similar to glut, its called glfw but I chose glut for my example because its more popular. And all my GL code runs flawlessly without including gl or glu. So i guess C::B does not to this "include file expansion", is there a way to turn it on/off? Or maybe it just doesn't parse includes that are inside a preprocessor condition.
blueshake:
--- Quote ---Or maybe it just doesn't parse includes that are inside a preprocessor condition.
--- End quote ---
#if
#else
is not supported.
ollydbg:
--- Quote from: blueshake on October 14, 2009, 12:38:39 pm ---#if
#else
is not supported.
--- End quote ---
From the source code of parserthrerad.cpp
--- Code: ---void ParserThread::HandlePreprocessorBlocks(const wxString& preproc)
{
if (preproc.StartsWith(ParserConsts::kw_if)) // #if, #ifdef, #ifndef
{
wxString token = preproc;
++m_PreprocessorIfCount;
token = m_Tokenizer.GetToken();
if (token.IsSameAs(_T("0")))
{
// TODO: handle special case "#if 0"
TRACE(_T("HandlePreprocessorBlocks() : Special case \"#if 0\" not skipped."));
}
m_Tokenizer.SkipToEOL();
}
else if (preproc==ParserConsts::kw_else || preproc==ParserConsts::kw_elif) // #else, #elif
{
TRACE(_T("HandlePreprocessorBlocks() : Saving nesting level: %d"), m_Tokenizer.GetNestingLevel());
m_Tokenizer.SaveNestingLevel();
wxString token = preproc;
while (!token.IsEmpty() && token != ParserConsts::kw_endif)
token = m_Tokenizer.GetToken();
--m_PreprocessorIfCount;
#if PARSERTHREAD_DEBUG_OUTPUT
int l = m_Tokenizer.GetNestingLevel();
#endif
m_Tokenizer.RestoreNestingLevel();
TRACE(_T("HandlePreprocessorBlocks() : Restoring nesting level: %d (was %d)"), m_Tokenizer.GetNestingLevel(), l);
}
else if (preproc==ParserConsts::kw_endif) // #endif
--m_PreprocessorIfCount;
}
--- End code ---
only #if is treated, and #else is omitted.
Navigation
[0] Message Index
Go to full version