4

ここで私の最初の質問:

C++ プロジェクトで libcURL を使用すると問題が発生します。リンクすらしてない。Windows XP と Visual C++ 2008 Express Edition を使用しています。

だからここに私がしたことがあります:

  1. ダウンロードした libcURL: curl-7.19.5-devel-mingw32.zip
  2. VC++ で新しいコマンドライン プロジェクトを開きました
  3. 新しいプロジェクトにフォルダ「lib」と「include」を含めます(些細なことかもしれませんが、しばらく時間がかかりました;-)
  4. Properties->C/C++->General: フォルダ 'include' を 'additional Folders to include' に追加
  5. Properties->Linker->General: フォルダ 'lib' を 'additional Folders with libraries' に追加
  6. Properties->Linker->Input: 追加の依存関係を追加しました:
  7. Properties->C/C++->Preprocessor: 定義 'CURL_STATICLIB' を追加
  8. 「プリコンパイル済みヘッダー」のチェックを外し、「マルチスレッド DLL (/MD)」が使用されていることを確認しました

サンプル simple.c ( http://curl.haxx.se/lxr/source/docs/examples/simple.cから) をメイン プロジェクト ファイルにコピーしました。コンパイルしようとすると、次の出力が得られます。

Neues Erstellen gestartet: Projekt: curl_project, Konfiguration: Debug Win32
Die Zwischen- und Ausgabedateien für das Projekt "curl_project" mit der Konfiguration "Debug|Win32" werden gelöscht.
Kompilieren...
stdafx.cpp
Kompilieren...
curl_project.cpp
Manifest in Ressourcen wird kompiliert...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation.  All rights reserved.
Verknüpfen...
libcurl.a(ftp.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(file.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_strtoll" in Funktion "_file_do".
libcurl.a(cookie.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(transfer.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(ssh.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(http.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(mprintf.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___umoddi3" in Funktion "_dprintf_formatf".
libcrypto.a(b_print.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___umoddi3".
libcrypto.a(bn_word.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___umoddi3".
libcurl.a(mprintf.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___udivdi3" in Funktion "_dprintf_formatf".
libcrypto.a(b_print.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___udivdi3".
libcrypto.a(e_atalla.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(eng_padlock.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__alloca" in Funktion "_ENGINE_load_padlock".
libcrypto.a(sha512.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(bn_prime.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(mprintf.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(formdata.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(err_prn.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(cryptlib.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(progress.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___divdi3" in Funktion "_time2str".
libssh2.a(scp.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_snprintf" in Funktion "_libssh2_scp_send_ex".
C:\Dokumente und Einstellungen\Punkx\Eigene Dateien\Visual Studio 2008\Projects\curl_project\Debug\curl_project.exe : fatal error LNK1120: 6 nicht aufgelöste externe Verweise.
Das Buildprotokoll wurde unter "file://c:\Dokumente und Einstellungen\Punkx\Eigene Dateien\Visual Studio 2008\Projects\curl_project\curl_project\Debug\BuildLog.htm" gespeichert.
curl_project - 22 Fehler, 0 Warnung(en)
========== Alles neu erstellen: 0 erfolgreich, Fehler bei 1, 0 übersprungen ==========

私が何を忘れたか、またはどこに問題があるか、誰かが見ることができますか? 私はC++の初心者なので、些細なことかもしれません...助けてくれてありがとう!

4

1 に答える 1

6

VisualC++コンパイラでMinGWライブラリを使用しています。正しいバイナリパッケージを使用するか、自分でビルドしてください。

Visual C ++を使用している場合は、.aファイルを処理するのではなく、.libのみを処理する必要があります。

于 2009-07-22T12:20:16.617 に答える