Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:28 Go to next message
Filip Dossche is currently offline Filip DosscheFriend
Messages: 4
Registered: February 2014
Junior Member
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 11:57 Go to previous messageGo to next message
Filip Dossche is currently offline Filip DosscheFriend
Messages: 4
Registered: February 2014
Junior Member
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 10:11 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1967
Registered: July 2009
Senior Member
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.

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
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: Sat Nov 22 15:38:55 GMT 2014

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

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