0

I am trying to compile my project with OSG and I installed all the necessary rpms for it in OpenSUSE 12.1. I'm not sure what is going on because all I did was #include and my compiler (gcc 4.6.2) crashes inside of it saying:

'expected identifier before '(' token'

The problem is when I click on the error, where it brings me to in the FileUtils is

enum Value {

OK,

SOURCE_EQUALS_DESTINATION,

... and so on

};

I don't understand what is going on and would greatly appreciate any help.

user1496542
  • 539
  • 2
  • 6
  • 14

2 Answers2

0

Clearly it is a syntax error somewhere, since the preprocessor came across something unexpected. The little snippet you posted already has one: you should have a semicolon after the ending brace of the enum (enum Value { ... };).

lynxlynxlynx
  • 1,371
  • 17
  • 26
  • Sorry that was a typo on my end. In the OSG code it has that semi-colon which is what stumps me... Why is it complaining of a '(' when there isn't one? – user1496542 Aug 07 '12 at 18:45
  • There is one later. You'll have to post more code for any remote debugging possibility. – lynxlynxlynx Aug 07 '12 at 19:28
  • hmm...my code all it does is #include and that's where it goes in further to FileUtils and then crashes. The errors include: /usr/include/osgDB/FileUtils:85:9: error: expected identifier before ‘(’ token /usr/include/osgDB/FileUtils:85:9: error: expected ‘}’ before ‘(’ token /usr/include/osgDB/FileUtils:85:9: error: expected unqualified-id before numeric constant /usr/include/osgDB/FileUtils:85:9: error: expected ‘)’ before numeric constant /usr/include/osgDB/FileUtils:101:21: error: ‘FileOpResult’ does not name a type – user1496542 Aug 07 '12 at 19:30
  • Even if you include it in a trivial hello world program? – lynxlynxlynx Aug 07 '12 at 19:32
  • You're not using the same compiler and it looks like gcc is stricter in this case. But more likely, there are platform-dependant #ifdefs in the headers, so the compiler doesn't even see the same code on windows. The fact that it works in a trivial program shows that the error is in your program, not in the header though! – lynxlynxlynx Aug 07 '12 at 19:52
  • ok...I shall look back over my code. Thanks for all the replies :) – user1496542 Aug 07 '12 at 20:01
0

Sometimes I get weird interactions if I am using multiple APIs and one #defines its constants instead of using nicely namespaced enumerations like OSG does. Maybe something you include before FileUtils is #define-ing "OK" or "Value", these are the most generic I can see in the lines that give you errors. Try #undef OK and #undef Value before your include, or otherwise avoid using preprocessor commands for constants.

Ruan Caiman
  • 881
  • 5
  • 5