#define EXAMPLE_MACRO(val_type, postfix) \
struct example_struct_postfix { \
val_type val; \
};
EXAMPLE_MACRO(int, name);
我想在这个例子中,生成的是example_struct_name,但是生成的是example_struct_postfix
大家好!请解释这些是 gcc、g++ 中的 -MD -MMF 选项。我经常在 premake5 中看到它们,CMake 生成的 Makefiles。但实际上没有关于它们的信息。我在 gcc.gnu.org 上找到了他们的解释,但我不明白这是什么意思。请帮帮我。
我想把这个库编译成一个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 程序,所以我需要做一些事情。他们到底给我写了什么?