看板 C_and_CPP 關於我們 聯絡資訊
我下載了GMP要到Visual Studio 2008使用 是選擇http://cs.nyu.edu/exact/core/gmp/ 裡面的 static GMP library and header file for Visual C++: gmp-static-vc-4.1.2.zip 那檔案裡面有1個.h檔, 2個lib檔案 我都複製到專案資料夾裡面 並且將.lib放到連結器裡面 (依照http://msdn.microsoft.com/zh-tw/library/ba1z7822%28VS.80%29.aspx 方法設定) (在開發環境中加入 .lib 檔做為連結器輸入) 但是現在建置以後出現 1>------ 已開始建置: 專案: 一般用專案, 組態: Debug Win32 ------ 1>正在連結... 1>LINK : fatal error LNK1104: 無法開啟檔案 'LIBC.lib' 1>------ 已開始建置: 專案: 一般用專案, 組態: Release Win32 ------ 1>正在連結... 1>main.obj : error LNK2001: 無法解析的外部符號 ___gmp_printf 1>main.obj : error LNK2001: 無法解析的外部符號 ___gmpz_init 1>main.obj : error LNK2001: 無法解析的外部符號 ___gmpz_init_set_str 1>main.obj : error LNK2001: 無法解析的外部符號 ___gmpz_add_ui 1>main.obj : error LNK2001: 無法解析的外部符號 ___gmpz_mul_ui 1>C:\Users\herman602\Desktop\一般用專案\Release\一般用專案.exe : fatal error LNK1120: 5 個無法解析的外部符號 以下為程式內容 #include <stdio.h> #include "gmp.h" void foo (mpz_t result, const mpz_t param, unsigned long n) { unsigned long i; mpz_mul_ui (result, param, n); for (i = 1; i < n; i++){ mpz_add_ui (result, result, i*7); } } int main (void) { mpz_t r, n; mpz_init (r); mpz_init_set_str (n, "123456", 0); foo (r, n, 20L); gmp_printf ("%Zd\n", r); return 0; } 請問是有什麼問題呢 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.49.9 ※ 編輯: herman602 來自: 123.195.49.9 (09/23 21:22)
QQ29:一般->其他程式庫目錄 設了沒 09/23 21:34
QQ29:你也可以都不設 直接拉到 方案管理員 跟cpp擺在一起 就ok 09/23 21:35
herman602:有把lib跟h檔案, 加到專案裡面了 09/23 21:38
QQ29:無法開啟檔案 'LIBC.lib 路徑有設對嘛 09/23 22:38
redsox:看起來你只有debug有設lib, 但release卻沒有 09/23 23:11
redsox:libc.lib是single thread library,vs2005以後都不支援 09/23 23:12
redsox:應該下載dynamic library的版本 09/23 23:13
herman602:visual studio竟然說 .dll損壞= = 09/24 00:05
redsox:到你給的link裡的patches and project files 09/24 12:01
redsox:去抓static或dynamic專案自己建立lib,應該可以用吧?! 09/24 12:02