我正在尝试将Chilkat C/C++库添加到适用于Windows 7的CodeBlocks(32位,版本12.11(中的项目中。
所以我去了http://www.chilkatsoft.com/downloads_mingw.asp,并下载了32位MinGW库。
然后在CodeBlocks中我做了:
- 设置>编译器>链接器设置>添加>C:\chilkat-9.5.0-mingw32\libchilkat9-.5.0.a
- 设置>编译器>搜索目录>编译器>添加>C:\chilkat-9.5.0-mingw32\include
- "设置">"编译器">"搜索目录">"链接器">"添加">C:\chilkat-9.5.0-mingw32
- 项目>生成选项…>项目根>链接器设置>添加>C:\chilkat-9.5.0-mingw32\libchilkat-5.0.a
- 项目>生成选项…>Project Root>搜索目录>编译器>添加>C:\chilkat-9.5.0-mingw32\include
- 项目>生成选项…>项目根目录>搜索目录>链接器>添加>C:\chilkat-9.5.0-mingw32
- 然后我将我的编译器设置为GNUGCC编译器
最后,我遇到了以下两个问题:
- 当我执行
#include<...>
并按下括号内的Ctrl+空格时,没有任何与Chilkat库相关的建议。请参阅下面的第一个代码块以获取完整的代码(非常简单( - 虽然该程序在包含
CkMailMan.h
的情况下成功构建,但当我实例化CkMailMan
时,它会中断,错误显示在下面的第二个代码块中
我怀疑这与库扩展名为".a"有关,该扩展名适用于Linux但是当我使用这个库的Visual Basic版本(extensions.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-vc10include -IC:chilkat-9.5.0-mingw32include -IC:chilkat-9.5.0-mingw32include -c C:TimeButlermain.cpp -o objDebugmain.o
mingw32-g++.exe -LC:chilkat-9.5.0-x86-vc10libs -LC:chilkat-9.5.0-mingw32 -LC:chilkat-9.5.0-mingw32 -o binDebugTimeButler.exe objDebugmain.o C:chilkat-9.5.0-x86-vc10libsChilkatDbg.lib C:chilkat-9.5.0-x86-vc10libsChilkatDbgDll.lib C:chilkat-9.5.0-x86-vc10libsChilkatRel.lib C:chilkat-9.5.0-x86-vc10libsChilkatRelDll.lib C:chilkat-9.5.0-x86-vc10libsChilkatDbg.lib C:chilkat-9.5.0-x86-vc10libsChilkatDbgDll.lib C:chilkat-9.5.0-x86-vc10libsChilkatRel.lib C:chilkat-9.5.0-x86-vc10libsChilkatRelDll.lib C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x51): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x14a): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x395): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x4cf): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x5d7): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x6df): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x15a): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x247): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x30b): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x35b): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x805): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x9c8): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.eh_frame+0x173): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x6a): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x522): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x666): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xa5): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x151): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x3fd): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x587): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x8af): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xbd3): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.eh_frame+0x3f): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x117): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x253): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x3bf): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x5ff): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x806): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x88b): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.eh_frame+0xcb): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x5b): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0xd6): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x142): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x3dd): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x451): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x4e2): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xd3): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x163): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x21b): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x862): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xfd9): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xff3): more undefined references to `_Unwind_Resume' follow
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(XString.o):XString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0xaf): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x15f): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x482): undefined reference to `_Unwind_Resume'
C:chilkat-9.5.0-mingw32libchilkat-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)
原来我需要切换到visual Studio C++编译器并以该编译器的格式下载库。我不能使用".a"扩展库是对的。