Archived

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

slice #include and scope rules

Im not sure what Im doing wrong.

File1.ice
#ifndef FILE1_ICE
#define FILE1_ICE
module Main{
  sequence<int> intOpt;
};
#endif

File2.ice
#ifndef FILE2_ICE
#define FILE2_ICE
#include <File1.ice>
module Main{
module Group1{
  struct Pkt{
    Main::intOpt num;
  };
};
};
#endif

I get an error saying "Main::intOpt is not defined".

Anyone know what it is I'm missing? (im sure it will be trivial :) )

Alfred

Comments

  • I just tried this with
    slice2cpp -I. File2.ice
    

    and it compiles without error. Can you post the command line you are using? Also, what compiler (slice2cpp, slice2java, etc) are you using, and on what platform?

    Cheers,

    Michi.
  • My Bad

    Thank you for your help as it made look somewhere else and I found it.

    Had nothing to do with scope at all.

    It had all to do with my sloppy cut-and-paste, I had the same #ifndef on both files. i.e. #ifndef FILE1_ICE and in file2.ice had ALSO #ifndef FILE1_ICE
    so the effect was that file1.ice was never parsed.

    thanks again.