ºìÁªLinuxÃÅ»§
Linux°ïÖú

Linux and Mac build issues

·¢²¼Ê±¼ä:2008-07-18 00:49:54À´Ô´:ºìÁª×÷Õß:mconela
(1) WindowsÉÏÃæµÄlibºÍdll¶ÔÓ¦LinuxÏÂÃæµÄlib**.a ºÍlib**.so£¬¶øÉú³ÉÕâ¸ö*.aºÍ*.soµÄÎļþ£¬¼´Ä¿±êÎļþΪ*.o ºÍ*.os

so ΪShared ObjectµÄ¼òд¡£

½ñÌìÎÒÔÚ×ö¿çƽ̨µÄbuildʱÅöµ½µÄÎÊÌâ¾ÍÊÇÓÃSConsµÄSharedLibraryµÄbuilder£¬¿ÉÊÇÔÚÇ°ÃæµÄ±àÒë½×¶ÎÈ´²úÉúµÄÊÇ*.oµÄÎļþ£¬¶øÕæÕýÐèÒªµÄÊÇ*.osµÄÎļþ¡£

ÔÚMacÉÏÃæStaticLibraryÊÇ*.a½á⣬SharedLibrary ÔòÊÇlib**.dylib½áβµÄ¡£

(2) ½ñÌì¶ÔlinkºÍbuildµÄ¹ý³ÌÓÐÁ˸üеÄÈÏʶ:
compiler½«*.cppÎļþbuildΪObject file, *.obj on Windows, *.o or *.os on POSIX platform;

linkµÄ¹¤¾ß»á½«ÕâЩobject file linkΪһ¸ölib»òdllµÈ¡£

½ñÌìÔçÉϺÜÔç¾ÍÅöµ½ÁËlink unresolved symbolµÄÎÊÌ⣬ÔÚÒ»¸öprojectÖÐÓ¦¸ÃÊDz»»á´æÔÚÕâÑùÎÊÌâµÄ£¬×îºó·¢ÏÖÔ­À´ÎÒÓÃSConsµÄGlobµÄ²Ù×÷ºó£¬Ã»Óн«ËùÓÐ×ÓfolderÏÂÃæµÄ¶«Î÷¶¼include½øÀ´ËùÖ¡£./win,./unixµÈÏÂÃæµÄcppûÓÐÉú³É*.objÎļþ¡£

(3) Typical preprocessor definitions:

ÒÔºó¿ÉÒԲο¼Õâ¸öÈ¥¶¨ÒåÔ¤´¦Àíºê

ÒýÓÃ:
#if defined(OSWin_)
#ifdef OM_BUILD_DLL
// dll export.
#define OM_Export _declspec(dllexport)
#else
// dll import, the normal way to use the library.
#define OM_Export _declspec(dllimport)
#endif
#elif defined(OSMac_) || defined(OSLinux_)
#define OM_Export
#endif
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ