Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-01-2007
mefoster mefoster is offline
Registered User
 
Name: Mary Ellen Foster
Organization: Technical University of Munich
Project: JAST human-robot dialogue system
 
Join Date: Jun 2006
Posts: 79
Output directories and include directories for slice2cpp

So, say I have a whole multi-level directory hierarchy of Ice files, some of which include one another. Something like this:

mod/sub1/Foo1.ice
Code:
module mod {
    module sub1 {
        interface Foo1 {
        };
    };
};
mod/sub2/Foo2.ice
Code:
#include <mod/sub1/Foo1.ice>

module mod {
    module sub2 {
        interface Foo2 {
        };
    };
};
If I do slice2cpp -I. mod/*/*.ice, I get a set of files, all in the target output directory. The #include statements make it sort of difficult to use them, though: in Foo1.cpp, it's got #include <Foo1.h>, with a similar statement in Foo2.cpp, but in Foo2.h there's #include <mod/sub1/Foo1.h>. So Foo1.h needs to be simultaneously in the same directory as Foo1.cpp and in a mod/sub1 subdirectory relative to Foo2.h.

Am I doing something wrong here? This seems to be overly complicated; it would be nice if the files got generated into a similar directory hierarchy as the Slice files. Or maybe I'm just seeing this all through my Java-programmer goggles and the true C++ way to do things is something else.

Thanks for any suggestions,

MEF
__________________
Mary Ellen Foster
Technical University of Munich
JAST human-robot dialogue system
Maintainer of Fedora Ice packages
Reply With Quote
  #2 (permalink)  
Old 08-01-2007
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 976
Hi Mary Ellen,

It can take a bit of trial & error to get the generated C++ code to your liking. The Slice translator does provide some options for customizing the generated #include statements, as described in section 6.15.1 of the manual.

Your first step should be to decide how you want the generated files to be structured. For example, do you want the header files and source files all in the same directory? Or will you be relocating the header files to a separate "include" directory?

As you've seen, the translator's default behavior for #include statements in header files is to mirror the the corresponding #include statements in the Slice files, so #include <mod/sub1/Foo1.ice> becomes #include <mod/sub1/Foo1.h>, reflecting the assumption that the header file will be located in a directory hierarchy similar to that of the Slice file. The manual describes how you can use -I options to influence this behavior.

Let us know if you're still having trouble.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 08-01-2007
Andreas Scherer Andreas Scherer is offline
Registered User
 
Name: Andreas Scherer
Organization: Private Linux Site
Project: Evaluating Ice-C++, Ice-Java, Ice-Python, Ice-Ruby
 
Join Date: Mar 2005
Location: Berlin, Germany
Posts: 47
Have you tried the "--output-dir" option of slice2cpp? Maybe this could help, if you compile the ice file(s) by hand.

If you put these preliminary steps into makefiles, you could "walk through" the slice file hierachy and compile the specifications in the respective directories directly.

Take care,
Andreas
Reply With Quote
  #4 (permalink)  
Old 08-01-2007
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 976
Just to be clear, you could run slice2cpp as follows:

$ slice2cpp -I. -Imod/sub1 mod/*/*.ice

Note that the first option (-I.) enables the compiler to locate the included file, whereas the only purpose of the second -I option is to customize the #include statements in the generated header files. As a result, the file Foo2.h should now contain #include <Foo1.h>.

If you want to modify the #include statement in a generated source file, you can use the --include-dir option. You would only do that if you were going to move the generated header file out of the directory containing the generated source file.

Naturally, whatever you do will have an impact on your application code, so you have to structure your source code, customize the generated #include statements, and specify the proper C++ compiler options so that everything builds properly.

Hope that helps,
- Mark
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pb with installation directories including space in name vermorel Bug Reports 2 12-08-2005 01:18 PM
ICE-2.0.0.zip doesn't have /bin and /lib directories. Arun Bug Reports 2 11-23-2004 01:06 AM
module names not correctly translated while generating directories in Java vsonnathi Bug Reports 1 11-08-2004 08:02 PM
IcePack.Registry.Data and IcePack.Node.Data directories vsonnathi Comments 0 10-21-2004 06:12 PM
slice2cpp output that won't compile record Bug Reports 1 06-25-2004 02:48 PM


All times are GMT -4. The time now is 12:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.