Archived

This forum has been archived. Please start a new discussion on GitHub.

Compile error using VERSION in module

(Ice.3.0.1):

I didn't see anything in the docs about not using this variable name, and the slice2cpp compiler doesn't generate an error.

given this slice file:

module SCXI {
const int VERSION = 1;

...
};

When I attempt to use ::SCXI::VERSION my in code on the server side I get this error:

main.cpp: In member function 'virtual bool SCXIService::start(int, char**)':
main.cpp:41: error: expected unqualified-id before numeric constant
make: *** [.obj/main.o] Error 1

However, if I change the name to VERS in the slice file and in my server side, and rebuild the project, it builds okay.

Comments

  • bernard
    bernard Jupiter, FL
    'VERSION' is not a special keyword in Ice: it should work just as 'VERS' does.

    Maybe VERSION is a macro in your C++ translation unit? In main.cpp, you could try something like:
    #undef VERSION
    #include <slice2cpp-generated-file>

    Bernard