Creative Commons License
本Blog采用 知识共享署名-非商业性使用-禁止演绎 3.0 Unported许可协议 进行许可。 —— Fox <游戏人生>

游戏人生

游戏人生 != ( 人生 == 游戏 )
站点迁移至:http://www.yulefox.com。请订阅本博的朋友将RSS修改为http://feeds.feedburner.com/yulefox
posts - 62, comments - 508, trackbacks - 0, articles - 7

ACE在cygwin下的使用

Posted on 2009-08-19 10:05 Fox 阅读(2564) 评论(4)  编辑 收藏 引用 所属分类: T技术碎语

本文同步自游戏人生

/*--------- Hello.cc ---------*/

/** Hello.cc:
* @File:   Hello.cc
* @Author: Fox <yulefox at gmail dot com>
* @Date:   Aug. 19th, 2009
* @Brief:  Test ACE log module application
*/

#define ACE_NTRACE 0            /// trace the calling position

#include "ace/Log_Msg.h"        /// include log module

int ACE_TMAIN(int, ACE_TCHAR *[])
{
     ACE_TRACE(ACE_TEXT("main"));

     ACE_DEBUG((LM_INFO, ACE_TEXT("%IStart\n")));
     ACE_DEBUG((LM_INFO, ACE_TEXT("%IEnd\n")));

     return 0;
}

/*--------- makefile ---------*/

BIN     = hello                       # src & exe file name
SRC     = $(addsuffix .cc, $(BIN))    # src file suffix
LIBS    = -lACE                       # libACE.dll under cygwin

include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU

/*--------- Compilation ---------*/

GNUmakefile: /home/fox/ace/GNUmakefile MAKEFLAGS=k

g++ -Wpointer-arith -mthreads -mtune=pentiumpro -O3 -g -pipe    -pipe   -I/usr/\
share/ace -DACE_HAS_EXCEPTIONS -DACE_NO_INLINE  -c -o .obj/hello.o hello.cc
g++ -Wpointer-arith -mthreads -mtune=pentiumpro -O3 -g -pipe    -pipe   -I/usr/\
share/ace -DACE_HAS_EXCEPTIONS -DACE_NO_INLINE  -Wl,--enable-auto-import -Wl,-E\
-L/usr/share/ace/lib -o hello .obj/hello.o  -lACE

Compilation finished at Wed Aug 19 00:35:42

/*--------- Result ---------*/

$ ./hello.exe
(14417928) calling main in file `hello.cc' on line 13
    Start
    End
(14417928) leaving main

-------------------------------------------------------

更多内容请参考C++NP(C++ Network Programming) vol.1 & vol.2和APG(The ACE Progrmmer's Guide)

忙活了一晚上,终于知道怎么包含头文件了,在gcc的编译选项中用 -I或/I$(ACE_ROOT):

本例中是:-I/usr/share/ace

结果后面库又链接不上,联想以前使用OpenGL库的LIBS,终于靠一个-lACE搞定。

因为不愿意用MPC,总感觉再多花些时间去弄又只是离题更远了,有兴趣的同学自然是可以通过ACE的官网找到所有问题的答案。

这样一来,ACE在cygwin下从安装到使用也就告一段落了,后面的问题就比较easy了,无非是你用ACE做什么。而我也不会再就ACE && cygwin写什么心得了,总算见证了这两天的捣腾。

Feedback

# re: ACE在cygwin下的使用  回复  更多评论   

2009-08-19 10:56 by 凡客诚品
不错啊

# re: ACE在cygwin下的使用  回复  更多评论   

2009-08-19 14:33 by 戴尔电脑
爱仕达撒娇的

# re: ACE在cygwin下的使用  回复  更多评论   

2009-08-21 17:23 by 戴尔电脑
上岛咖啡多少积分

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理