• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            EverSpring working shop

            To pursue creative ideas based on nature.

            統(tǒng)計(jì)

            留言簿(1)

            他山之石

            閱讀排行榜

            評論排行榜

            How to Compile/Test Loki source code in Linux

            Previously, I review and test the source code of the Loki under the windows XP by the visual C++ express. It is easy to compile and test the Loki code in windows. Just download the zip file or the .exe file from the sourceforge website. The directory contains the Visual C++ project file, which can read the makefile automatically and compile the code in the test directory very easily. However, you may not know the dependency between the src files in this project because they are hidden in the makefile and the src code themselves.
            ?
            Today, I update my PC to the Linux Enviroment and tried to re-install the visual C++ express in the windows based on the vmware. Unfortunately, the VC++ express failed to be installed sucessfully due to some unknown errors. So I turn to compile and test the code purely in the Linux envrioment, as the Loki states that it is completely supported by the gcc.
            ?
            Actually, it is a little mysterial that how to compile the test code, at least generate?the .o file to run under the command line, because I am not sure how to dedicate the include path for a specified src file and futher how to include other src files on which the on-testing files are depending.
            ?
            Select the file Factory.cpp as an example. Before I test the this src file, I have no idea that which files should this Factory.cpp use.
            First step, because all the .h files this Loki project uses are all stored in the directory ../loki-0.1.7/include, even I have no compelete knowlege that which .h files are used in this test, I can indicate the g++ compiler to search the dedicated directory firstly before the current directory and the system including directory. Just like below:
            ?
            g++ -I? /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/include/ -o /localdisk/data/alex_dyn/hello /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/test/Factory/Factory.cpp
            ?
            However, although the .h files can be found, many errors? like "undefined reference to `Loki::SmallObjAllocator::~SmallObjAllocator()" blocks the generation of the hello.o. It is because some implementation of the methods are not found. Actually, only the .h files are inlcuded, but the implementaiton files are not found.
            So, I need to find where these undefined references are, i.e, find the src files which the Factory.cpp depends on. As the all the source files are already added to the sourceinsight tool project, it is easy to find that the undefined references are from two files Singleton.cpp and SmallObj.cpp. Actually, all the libary src .cpp files (not the testing files with main() function )?are in the directory /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/src.
            How to let the Factory.cpp to know where these undefined reference to be found? I ever tried to dedicate the src directory in the compiling process, but failed. When checking the priciple for writing the Makefile in the linux envriroment, it is found that I can compile the depending files to .o files firstly, with the compile option -c, which means no executive files are generated for those src files without main() function. Usage of the -c option?is usually used to make the modules which?are linked later to?other modules.?
            ?
            So the next step?is to?compile the Singleton.cpp and SmallObj.cpp to generat the?middle product Singleton and SmallObj.
            ?
            g++ -c -I? /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/include/ -o /localdisk/data/alex_dyn/SmallObj /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/src/SmallObj.cpp
            g++ -I? /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/include/ -c -o /localdisk/data/alex_dyn/Singleton /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/src/Singleton.cpp
            ?
            We can see two result files: SmallObj and Singleton in directory /localdisk/data/alex_dyn
            [alexzh@alexzhang_lnx alex_dyn]$ ll /localdisk/data/alex_dyn
            total 328
            drwxr-xr-x? 2 root?? root????? 4096 Feb? 6 19:54 boost
            drwxr-xr-x? 3 root?? root????? 4096 Feb 15 15:45 loki
            -rw-r-----? 1 alexzh NSS_VC??? 7260 Feb 15 17:07 Singleton
            -rw-r-----? 1 alexzh NSS_VC?? 57244 Feb 15 16:47 SmallObj

            With these two depending files,?I tried to?linked them to Factory.cpp when compiling the Factory.cpp as:
            [alexzh@alexzhang_lnx src]$ g++ -I? /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/include/ -o /localdisk/data/alex_dyn/hello /localdisk/data/alex_dyn/Singleton/localdisk/data/alex_dyn/SmallObj /localdisk/data/alex_dyn/loki/loki-0.1.7/loki-0.1.7/test/Factory/Factory.cpp
            The final executive file hello are found in the /localdisk/data/alex_dyn now. Enter this?diretory and execute the hello as
            [alexzh@alexzhang_lnx alex_dyn]$ pwd
            /localdisk/data/alex_dyn
            [alexzh@alexzhang_lnx alex_dyn]$ hello
            ?
            creator function is a simple function:
            createProductNull()
            createProductParm( int a, int b )
            ?
            creator function is a overloaded function:
            createProductOver()
            createProductOver( int a, int b )
            ?
            creator function is a member function:
            Creator::create()
            Creator::create( int a, int b )
            ?
            creator function is a template member function
            CreatorT<T>::create()
            CreatorT<T>::create( int a, int b )
            ?
            creator function is a functor parameter
            createProductParm( int a, int b )
            ??? called by createProductRuntime(CreateFunctor func, int a, int b)
            CreatorT<T>::create( int a, int b )
            ??? called by createProductRuntime(CreateFunctor func, int a, int b)
            ?
            Registered ids:
            Four
            One
            Three
            Two
            ?
            OK, that is the way I can follow to debug the rest files in this Loki project......Opps..
            ?

            posted on 2009-02-15 19:43 everspring79 閱讀(1650) 評論(4)  編輯 收藏 引用 所屬分類: Notes

            評論

            # re: How to Compile/Test Loki source code in Linux 2009-02-15 20:08 everspring79

            For any suggestion or experience of you on this pratice, please kindly reply this tip directly. Thanks!  回復(fù)  更多評論   

            # re: How to Compile/Test Loki source code in Linux 2009-02-16 09:25 zuhd

            nice English, how can you do this, really amazing!  回復(fù)  更多評論   

            # re: How to Compile/Test Loki source code in Linux 2009-02-16 11:53 true

            ni de ying yu hen hao ,ru he zuo dao de?mao si ni zai wai qi  回復(fù)  更多評論   

            # re: How to Compile/Test Loki source code in Linux[未登錄] 2009-02-16 11:58 Everspring79

            @true
            Yes, English is our working language, which is mandatory in all kinds of communications like email, conference, presentation, document, etc. Actually, it is quite simple to use English for technical communication, compared with the daily English.  回復(fù)  更多評論   

            亚洲国产精品一区二区三区久久| 久久91亚洲人成电影网站| 久久久久亚洲精品天堂久久久久久| 国产精品美女久久久久av爽| 久久久久国产亚洲AV麻豆| 久久se精品一区二区影院| 久久久久香蕉视频| 人妻无码αv中文字幕久久| 91性高湖久久久久| 熟妇人妻久久中文字幕| 亚洲国产精品热久久| 思思久久好好热精品国产| 久久久久久久综合日本亚洲 | 久久婷婷五月综合97色| 中文精品久久久久国产网址| 久久久久久久久久久| 精品久久一区二区三区| 无码国内精品久久综合88| 久久综合综合久久97色| 无码伊人66久久大杳蕉网站谷歌 | 色综合合久久天天综合绕视看| 亚洲欧美日韩精品久久亚洲区| 1000部精品久久久久久久久| 一本久道久久综合狠狠躁AV| 国产成人99久久亚洲综合精品 | 国产精品久久久福利| 久久AV高潮AV无码AV| 久久精品夜色噜噜亚洲A∨| 狠狠色丁香婷婷综合久久来 | 国产精品亚洲美女久久久| 久久久久AV综合网成人| 亚洲国产视频久久| 日韩欧美亚洲综合久久影院Ds| 久久综合狠狠综合久久激情 | 久久er国产精品免费观看2| 欧美黑人又粗又大久久久| 色88久久久久高潮综合影院| 狠狠色婷婷久久综合频道日韩| 国产99久久久国产精品小说 | 精品久久人妻av中文字幕| 国产A级毛片久久久精品毛片|