本文同步自游戏人生
/*--------- 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写什么心得了,总算见证了这两天的捣腾。