ICE的helloword

fedora16的环境
yum install ice*

vim Printer.ice
interface Printer
{
void printString(string s);
};

slice2cpp Printer.ice
会报错哦
`Printer ':   an   interface   can   be   defined   only   at   mod
ule   scope
改成
[root@localhost ice]# cat Printer.ice 
module   Demo   
{ 
        interface   printer 
        { 
                void   printString(string   s); 
        }; 
}; 
[root@localhost ice]# 

再slice2cpp Printer.ice
生成
[root@localhost ice]# ll
总用量 36
-rw-r--r--. 1 root root 10235  4月 25 02:53 Printer.cpp
-rw-r--r--. 1 root root 17540  4月 25 02:53 Printer.h
-rw-r--r--. 1 root root   125  4月 25 02:53 Printer.ice
[root@localhost ice]# 

代码一堆
生成的c++如果各种迷糊,那就看java的吧
$ mkdir generated
$ slice2java --output-dir generated Printer.ice


自己还是别扯了,看附件吧,虽然比较老了,但是有指导意义,

猜你喜欢

转载自haoningabc.iteye.com/blog/1504377
ice
今日推荐