0

我正在尝试将 Chilkat C/C++ 库添加到适用于 Windows 7 的 CodeBlocks(32 位,版本 12.11)中的项目中。

于是我去了http://www.chilkatsoft.com/downloads_mingw.asp,下载了 32 位 MinGW 库。

然后在 CodeBlocks 我做了:

  1. 设置>编译器>链接器设置>添加>C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a
  2. 设置>编译器>搜索目录>编译器>添加>C:\chilkat-9.5.0-mingw32\include
  3. 设置>编译器>搜索目录>链接器>添加>C:\chilkat-9.5.0-mingw32
  4. 项目>构建选项...>项目根>链接器设置>添加>C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a
  5. 项目>构建选项...>项目根目录>搜索目录>编译器>添加>C:\chilkat-9.5.0-mingw32\include
  6. 项目>构建选项...>项目根目录>搜索目录>链接器>添加>C:\chilkat-9.5.0-mingw32
  7. 然后我将我的编译器设置为 GNU GCC Compiler。

最后,我遇到了这两个问题:

  1. 当我这样做#include<...>并在括号内按Ctrl+Space时,没有任何与 Chilkat 库相关的建议。请参阅下面的第一个代码块以获取完整代码(非常简单)。
  2. 虽然程序使用包含成功构建CkMailMan.h,但在我实例化时它会中断CkMailMan,错误显示在下面的第二个代码块中。

我怀疑这与用于 Linux 的库扩展名“.a”有关。但是,当我执行此库的 Visual Basic 版本(扩展名 .dll)并使用 Microsoft Visual C++ 2010 编译器时,我遇到了同样的问题。有任何想法吗?

代码:

#include <iostream>
#include <CkMailMan.h>
using namespace std;

CkMailMan mailman;
int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

运行代码时构建日志中的错误消息:

-------------- Build: Debug in TimeButler (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions  -g    -IC:\chilkat-9.5.0-x86-vc10\include -IC:\chilkat-9.5.0-mingw32\include -IC:\chilkat-9.5.0-mingw32\include  -c C:\TimeButler\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\chilkat-9.5.0-x86-vc10\libs -LC:\chilkat-9.5.0-mingw32 -LC:\chilkat-9.5.0-mingw32  -o bin\Debug\TimeButler.exe obj\Debug\main.o    C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbgDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRel.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRelDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbgDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRel.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRelDll.lib C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a 
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x51): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x14a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x395): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x4cf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x5d7): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x6df): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x15a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x247): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x30b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x35b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x805): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x9c8): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.eh_frame+0x173): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x6a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x522): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x666): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xa5): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x151): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x3fd): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x587): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x8af): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xbd3): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.eh_frame+0x3f): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x117): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x253): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x3bf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x5ff): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x806): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x88b): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.eh_frame+0xcb): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x5b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0xd6): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x142): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x3dd): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x451): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x4e2): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xd3): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x163): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x21b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x862): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xfd9): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xff3): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0xaf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x15f): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x482): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x733): undefined reference to `_Unwind_Resume'
Process terminated with status 1 (0 minutes, 10 seconds)
50 errors, 0 warnings (0 minutes, 10 seconds)
4

1 回答 1

0

结果我需要切换到 Visual Studio C++ 编译器并以该编译器的格式下载库。关于无法使用“.a”扩展库,我是对的。

于 2015-07-03T05:32:24.470 回答