Home Bug Reports

Compile error using VERSION in module

ctennisctennis Member Caleb TennisOrganization: AEIProject: Project GINA ✭✭✭

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.


  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    '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>

Sign In or Register to comment.