我想把这个库编译成一个dll,但要么我很愚蠢,要么有些东西不起作用。
https://github.com/nathan-osman/win32pe
我下载了最新版本的boost、cmake-gui、mingw,将BOOST_ROOT=boost-xx属性添加到cmake(来自boost网站的win32存档中的文件夹),将mingw32/bin文件夹添加到系统PATH,点击配置和生成,结果一切,cmake 工作。
接下来,我在为构建选择的文件夹中打开一个命令窗口,并在其中写入 mingw32-make.exe。这个废话出现了:
C:\win32pebuild>mingw32-make.exe
[ 16%] Building CXX object win32pe/CMakeFiles/win32pe.dir/src/file.cpp.obj
C:/win32pe/win32pe/include/win32pe/fileheader.h:45:9: error: expected identifier before numeric constant
i386 = 0x014c,
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:45:9: error: expected '}' before numeric constant
C:/win32pe/win32pe/include/win32pe/fileheader.h:45:9: error: expected unqualified-id before numeric constant
In file included from C:\win32pe\win32pe\src\file_p.h:32:0,
from C:\win32pe\win32pe\src\file.cpp:32:
C:/win32pe/win32pe/include/win32pe/fileheader.h:64:16: error: expected unqualified-id before ')' token
FileHeader();
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:65:16: error: expected unqualified-id before 'const'
FileHeader(const FileHeader &other);
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:65:16: error: expected ')' before 'const'
C:/win32pe/win32pe/include/win32pe/fileheader.h:66:25: error: declaration of '~win32pe::FileHeader' as non-member
virtual ~FileHeader();
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:68:50: error: 'win32pe::FileHeader& win32pe::operator=(const win32pe::FileHeader&)' must be a nonstatic member function
FileHeader &operator=(const FileHeader &other);
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:70:24: error: non-member function 'uint16_t win32pe::machine()' cannot have cv-qualifier
uint16_t machine() const;
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:71:30: error: non-member function 'uint32_t win32pe::timeDateStamp()' cannot have cv-qualifier
uint32_t timeDateStamp() const;
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:72:32: error: non-member function 'uint16_t win32pe::characteristics()' cannot have cv-qualifier
uint16_t characteristics() const;
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:74:1: error: expected unqualified-id before 'private'
private:
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:78:5: error: 'friend' used outside of class
friend class FilePrivate;
^
C:/win32pe/win32pe/include/win32pe/fileheader.h:81:1: error: expected declaration before '}' token
}
^
win32pe\CMakeFiles\win32pe.dir\build.make:62: recipe for target 'win32pe/CMakeFiles/win32pe.dir/src/file.cpp.obj' failed
mingw32-make.exe[2]: *** [win32pe/CMakeFiles/win32pe.dir/src/file.cpp.obj] Error 1
CMakeFiles\Makefile2:92: recipe for target 'win32pe/CMakeFiles/win32pe.dir/all' failed
mingw32-make.exe[1]: *** [win32pe/CMakeFiles/win32pe.dir/all] Error 2
makefile:128: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
C:\win32pebuild>
在 ubuntu 上一切都很好,但我正在编译一个需要 dll 的 windows 程序,所以我需要做一些事情。他们到底给我写了什么?
正如我已经在你关于 LOR 的主题中写的那样,问题是当在 32 位 x86 下编译时(无论哪个操作系统),gcc 定义了一个宏
i386
,并且在代码中使用相同的标识符来定义一个常量。在这里修复:https ://github.com/nathan-osman/win32pe/pull/1
也许升压尚未以这种方式连接,因为在存储库中很明显,使用 unix 的人收集。需要添加