C++ 使用mingw编译时应该包含哪些lib?
我正在尝试使用MinGW编译器(在linux上)为windows编译 我尝试了直截了当的方法:C++ 使用mingw编译时应该包含哪些lib?,c++,linux,windows,mingw,mapi,C++,Linux,Windows,Mingw,Mapi,我正在尝试使用MinGW编译器(在linux上)为windows编译 我尝试了直截了当的方法: $ i686-w64-mingw32-g++ swpmain.h swpmain.cpp swap.h swap.cpp // // bunch of warnings here... // /tmp/ccggw42y.o:swap.cpp:(.text+0x2f9): undefined reference to `_MAPIInitialize@4' /tmp/ccggw42y.o:swap.cp
$ i686-w64-mingw32-g++ swpmain.h swpmain.cpp swap.h swap.cpp
//
// bunch of warnings here...
//
/tmp/ccggw42y.o:swap.cpp:(.text+0x2f9): undefined reference to `_MAPIInitialize@4'
/tmp/ccggw42y.o:swap.cpp:(.text+0x31c): undefined reference to `_MAPIAllocateBuffer@8'
/tmp/ccggw42y.o:swap.cpp:(.text+0x350): undefined reference to `_MAPIUninitialize@0'
/tmp/ccggw42y.o:swap.cpp:(.text+0x41a): undefined reference to `_MAPIAllocateBuffer@8'
/tmp/ccggw42y.o:swap.cpp:(.text+0x445): undefined reference to `_MAPIAllocateBuffer@8'
/tmp/ccggw42y.o:swap.cpp:(.text+0x65f): undefined reference to `_MAPIAllocateBuffer@8'
/tmp/ccggw42y.o:swap.cpp:(.text+0xf5b): undefined reference to `_MAPIFreeBuffer@4'
/tmp/ccggw42y.o:swap.cpp:(.text+0xf6c): undefined reference to `_MAPIFreeBuffer@4'
/tmp/ccggw42y.o:swap.cpp:(.text+0x1782): undefined reference to `_MAPIFreeBuffer@4'
collect2: ld returned 1 exit status
ld
错误提示我忘了包含一些库-但我不知道是哪一个。我尝试在usr/中搜索文件,但只找到mapi.h
和mapix.h
标题-没有库
我做错了什么?libmapi32.a怎么样?还有一个
libdwmapi.a
。试试看。@thokra-是的,成功了@thokra-我还需要-static libgcc
和-static libstdc++
选项,以便将libs捆绑到可执行文件中,是吗?为什么这是必要的?真的很奇怪…@thokra-它们在我用来测试的windows机器上不存在(这是一个赤裸裸的WinXP安装)。因此,如果我不使用这些选项,它将拒绝启动。