2012年5月31日 星期四

Using jsoncpp with VS2008


在專案使用jsoncpp build過程一些筆記:
1. Debug版沒什麼問題 直接用就好

2. Release版 首先要把Project properties->configuration properties->C/C++->code generation 改成/MT
但在我的project裡面用MT會有錯誤,我的project是使用Multi threaded DLL/MD
所以要把jsoncpp也改成MD(如下圖)。不知道是不是要跟project配合,沒實驗。













3. compile自己的專案會出現以下error
Error 857 fatal error C1083: Cannot open compiler generated file: '../../build/vs71/Release/lib_json\json_reader.asm': No such file or directory d:\jsoncpp-src-0.6.0-rc2\src\lib_json\json_reader.cpp 1
有兩個solution:
(1)將jsoncpp中build/vs71那個folder拉到跟error msg一樣的位置。這個case就是往上拉兩個folder層級。
(2)或到jsoncpp的project properties->configuration properties->C/C++->Output Files
將Assembler output改成No Listing就不會出現錯誤了。(如下圖)










//==============
簡單記一下VS2008使用lib的方法
1.先include header檔
Project properties->configuration properties->C/C++->General->Additional include directories
加入.\include所在目錄
2.Linker加入lib檔
Project properties->configuration properties->Linker->General->Additional Library dependencies
加入.\lib所在目錄
Project properties->configuration properties->Linker->Input->Additional dependencies 
加入.lib檔案名稱

也可以加入command line指令或用vs2008中tools->options->Projects and solutions->vc++ directories加入lib跟inlcude路徑。

1 則留言:

  1. Hello Eray,
    謝謝你的文章,讓我的jsoncpp 可以build成 Release Mode.
    謝謝

    回覆刪除