Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » odd problem with CDT parser(Parser behaviour)
odd problem with CDT parser [message #1397807] Thu, 10 July 2014 03:28 Go to next message
Eclipse UserFriend
Hi,

I have an odd problem with the CDT parser in Eclipse (actually Xilinx SDK but essentially that is Eclipse + CDT).

I have two header files: for simplicity Header1.h and header2.h.
For the moment both header files are only included from within a single C file.
Potentially though they could be included from cpp files in the same project so I have foreseen the following snippets of code at the start and end of the files in both of them:

#ifdef __cplusplus
extern "C"
{
#endif

...
 
#ifdef __cplusplus
}
#endif


The odd thing is that the CDT parser correctly handles and shows header2.h but it shows it does not like the 'extern "c"' in header1.h and every other line within it.
Like header2.h the file is OK though because it is used in the project and works flawlessly.
As soon as I include header1.h into a cpp file the problem goes away but I would rather not do that unless it is necessary.

Anyone out there with ideas/suggestions on what the cause is and how to solve this one ?
Re: odd problem with CDT parser [message #1397958 is a reply to message #1397807] Thu, 10 July 2014 07:57 Go to previous messageGo to next message
Eclipse UserFriend
It is not exactly a perfect or conventional solution but I have found a workaround:

My project is built using existing makefiles which Eclipse does not touch.
So I have added a "Dummy.cpp" file to my project which does not nothing else than include the problematic header file(s).

Eclipse now does the job, the Dummy.cpp is included into SVN but stays completely out of my project build.
Re: odd problem with CDT parser [message #1398613 is a reply to message #1397958] Fri, 11 July 2014 06:11 Go to previous message
Eclipse UserFriend
If you have just the header file then Eclipse does not know if it is C or C++ code. If you include your header from a cpp file then the symbol __cplusplus is defined and Eclipse will recognize it.
Previous Topic:Wish list of things to be added to Eclipse Luna 4.4.0
Next Topic:Project-specific environment variables appear to only get defined in Debug
Goto Forum:
  


Current Time: Thu Jul 17 08:05:41 EDT 2025

Powered by FUDForum. Page generated in 0.12466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top