我在Linux(Ubuntu 11.04)上使用Mingw32编译了一个小应用程序,在Wine中运行正常,但在Windows上却没有任何作用(虽然它可以运行)。
配置:
./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --build=i686-linux
(我尝试过不加--target
和--build
,但结果相同。)
编译:
i586-mingw32msvc-g++ -DHAVE_CONFIG_H -I. -I.. -DLOG_DOMAIN=\"tpv\" -I.. -DWINVER=0x0400 -D_WINDOWS_ -Wall -g -Wl,--subsystem,console -mconsole -mms-bitfields -g -O2 -MT tpv-excepciones.o -MD -MP -MF .deps/tpv-excepciones.Tpo -c -o tpv-excepciones.o
链接:
/bin/bash ../libtool --tag=CXX --mode=link i586-mingw32msvc-g++ -Wall -g -Wl,--subsystem,console -mconsole -mms-bitfields -g -O2 -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid -lmingw32 -Wl,-subsystem,console -o tpv.exe tpv-excepciones.o tpv-conf.o tpv-main.o
它生成的是一个不是Linux二进制文件的.exe文件。在Wine中运行正常,但在Windows XP上没有任何作用。
通过阅读网页,我在配置时添加了一些标志:
-Wl,--subsystem,console -mconsole -mms-bitfields
这就是程序:
#include <windows.h>
#include "main.hh"
int main (int argc, char ** argv)
{
MessageBox (0, "Joder!", "Ermmm...", MB_OK);
//utils::conf c ("configuracion.3D");
//std::cout << "Valor de 'no': '" << c["TEXTO_ERROR"] << "'" << std::endl;
//std::cout << "..." << std::endl;
return 0;
}
我已经尝试过网上找到的所有方法,但都没有效果。我是不是漏掉了什么?
main.hh
还是可能是main.h
吗? - Error withit