在Windows 7(Mingw,Code :: Blocks)下进行编译,以获取Botan Library测试程序



我一直在徒劳地尝试将此测试程序编译

   #include <botan/botan.h>

   int main()
   {
       Botan::LibraryInitializer init;
   }

我从网站下载了库来源。我运行了configure.py,运行良好。然后,我尝试运行mingw-make

这是我遇到的错误

c:Botan-1.11.7>mingw32-make
g++  -m64 -pthread -fPIC -fvisibility=hidden -std=c++11 -D_REENTRANT -fstack-pro
tector -O3 -momit-leaf-frame-pointer -Wall -Wextra -Wstrict-aliasing -Wstrict-ov
erflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wold-s
tyle-cast -Wzero-as-null-pointer-constant -Ibuildinclude -c C:Botan-1.11.7src
libalgo_basescan_name.cpp -o buildobjlibsrc_lib_algo_base_scan_name.obj
C:Botan-1.11.7srclibalgo_basescan_name.cpp:1:0: warning: -fPIC ignored for
target (all code is position independent) [enabled by default]
C:Botan-1.11.7srclibalgo_basescan_name.cpp:1:0: sorry, unimplemented: 64-bi
t mode not compiled in
mingw32-make: *** [buildobjlibsrc_lib_algo_base_scan_name.obj] Error 1

我搜索了Google和我能找到的任何可用论坛。我在其网站上的隐藏文件夹中找到了窗口的预构建库。但是,该软件包包含LIB和DLL文件,而不是Mingw所需的文件。我试图使用创建.A文件的程序lib2a。我已经将此文件添加到我的代码:: blocks链接器选项中。我还包括包含文件夹。

当我尝试编译时,我会收到此错误。

C:botanincludebotaninit.h|41|undefined reference to `_imp___ZN5Botan18LibraryInitializer10initializeERKSs'|

似乎看不到具有功能定义的库,但是我迷失在从这里去的地方。

mingw32 -make具有-m64标志集,这意味着它正在尝试构建一个64位库。要构建一个64位库,您需要获得mingw-w64。

运行configure.py时,它可能会设置您的makefile来构建一个64位库。您需要检查输出中设置了哪些选项。这包括构建32位或64位的选项。无论哪种方式,您都需要一些变体:Python configure.py -os = mingw -cc = gcc

这个问题也有类似的错误,并建议使用mingw-w64,这将允许您构建一个64位库:在Eclipse中使用Mingw 32位的64位DLL

为了使用命令行构建MingW32-Make,您还需要在Windows路径中添加Mingw-W64 bin目录,并可能删除代码:: blocks blocks从路径中打包的mingw以避免冲突。您仍然会使用mingw32 make用mingw-w64来构建库;即使它被命名为mingw32-make,它将建造64位。

如果您决定构建库64位,则还需要构建应用程序64位,因此您需要设置MINGW-W64的Code :: Blocks。要在code ::块中设置mingw-w64,请参阅此问题:设置mingw和code :: blocks in Windows 8 64位。

最新更新