1. 程式人生 > >cgns編譯(cgns.org官方版)

cgns編譯(cgns.org官方版)

Installation Instructions using cmake

使用cmake的編譯方法

首先下載hdf5-cmake版本,然後直接執行其中的vs201x.32(64).bat即可。如果說ctest不是可執行檔案,就編輯bat檔案,把ctest的目錄加上,即可。

另外,也可以直接下載已經編譯好的hdf5庫檔案,然後解壓,安裝,即可。

第二步,下載cgns的cmake分支的原始碼。然後啟動cmake-gui,指定source dir為cgns原始碼根目錄,指定隨便一個build目錄。

然後configure。等著出現選項時,選中use_hdf5,然後再configure。出現更多的選項,包括zlib_library,szip_library等,設定好,再configure一遍。直到沒有問題了,然後generate。在build目錄中會看到.sln等等一大堆檔案。

此時,還需要把build/src目錄下cgnstypes.h等等檔案拷貝到上一級的src目錄中。
 

第三步,開啟sln,右鍵cgns_static專案,編譯即可。

這是什麼意思?
錯誤    LNK1112    模組計算機型別“x64”與目標計算機型別“x86”衝突    cgns_static    D:\build\src\x64\Debug\cgns_error.obj    1    

有2個地方需要注意:

1)連結器選項中,命令列,保證沒有/machine:X86任何類似的設定

2) 連結器-高階選項中,目標計算機 /Machine選項刪除,保證該項未設定;
Check the Linker > Command Line property page to make sure there is no /MACHINE switch there
1 if you find /MACHINE ** in the additional optionswindow, just deletle it.
2. if you find /MACHINE ** in the all options window,go to the Linker > Advanced property page and make sure that Target Machine is "Not Set".
這樣應該就不會出現上述錯誤,win32和x64平臺都可以成功編譯。

如果出現錯誤“庫型別x64和目標計算機衝突x86”之類的錯誤,顯然是,庫檔案為x64格式,而要編譯的exe檔案為x86。