【发布时间】:2009-06-15 09:48:28
【问题描述】:
我在将 Botan 编译为 Visual C++ 中的静态库方面非常不成功。 build.h 文件包含以下代码:
#ifndef BOTAN_DLL
#define BOTAN_DLL __declspec(dllexport)
#endif
这个宏随后会在 Botan 代码库中的几乎所有地方出现,如下所示:
class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
我从previous question 的理解是,您需要做的就是定义没有值的 BOTAN_DLL,它应该可以编译为静态库。但是,这样做会导致大量构建错误,例如“缺少标签名称”。有人知道怎么做吗?
编辑:以下是将 /D "BOTAN_DLL" 添加到 makefile 导致的错误示例:
cl.exe /Ibuild\include /O2 /EHsc /GR /D_CONSOLE /D "BOTAN_DLL" /nologo
/c src\checksum\adler32\adler32.cpp /Fobuild\lib\adler32.obj
adler32.cpp
build\include\botan/allocate.h(19) : error C2332: 'class' : missing tag name
build\include\botan/allocate.h(19) : error C2143: syntax error : missing ';' bef
ore 'constant'
build\include\botan/allocate.h(19) : error C2059: syntax error : 'constant'
build\include\botan/allocate.h(20) : error C2143: syntax error : missing ';' bef
ore '{'
build\include\botan/allocate.h(20) : error C2447: '{' : missing function header
(old-style formal list?)
build\include\botan/secmem.h(229) : error C2143: syntax error : missing ';' befo
re '*'
build\include\botan/secmem.h(230) : see reference to class template inst
antiation 'Botan::MemoryRegion<T>' being compiled
build\include\botan/secmem.h(229) : error C4430: missing type specifier - int as
sumed. Note: C++ does not support default-int
【问题讨论】:
-
能否请您引用一些无法编译且 BOTAN_DLL 定义为空字符串的源代码?
标签: c++ visual-c++ cryptography botan