我正在尝试使用Winelib在macOS上编译win32应用程序。如果可能的话,我更愿意使用Xcode提供的标准macOS编译器。但是,到目前为止,我无法编译它。如果我尝试使用以下内容编译test.cpp文件:
#include <windows.h>
#include <list>
int main(int argc, char *argv[]) {
std::list<int> blah;
blah.push_back(1);
return 0;
}
使用以下命令在Ubuntu 16.04上:
g++ -c -W -fexceptions -fshort-wchar -DWIN32 -D_DEBUG -D_WINDOWS -I/usr/include/wine-development/windows/ -I/usr/include/wine-development/msvcrt/ test.cpp
...我收到一些编译器警告,但它仍然可以成功编译。
但是,如果我尝试使用以下等效命令在macOS上编译相同的文件:
clang++ -c -W -fexceptions -fshort-wchar -DWIN32 -D_DEBUG -D_WINDOWS -I/usr/local/Cellar/wine/3.0/include/wine/msvcrt -I/usr/local/Cellar/wine/3.0/include/wine/windows test.cpp
...我得到以下编译器错误,我不知道如何修复:
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:104:9: error: no member named 'lldiv_t' in the global namespace
using ::lldiv_t;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:110:9: error: no member named 'atoll' in the global namespace; did you
mean 'atol'?
using ::atoll;
~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:186:23: note: 'atol' declared here
__msvcrt_long __cdecl atol(const char*);
^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:113:9: error: no member named 'strtof' in the global namespace
using ::strtof;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:114:9: error: no member named 'strtold' in the global namespace
using ::strtold;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:117:9: error: no member named 'strtoll' in the global namespace
using ::strtoll;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:121:9: error: no member named 'strtoull' in the global namespace; did you
mean 'strtoul'?
using ::strtoull;
~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:205:24: note: 'strtoul' declared here
__msvcrt_ulong __cdecl strtoul(const char*,char**,int);
^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:132:9: error: no member named '_Exit' in the global namespace; did you
mean '_exit'?
using ::_Exit;
~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:179:23: note: '_exit' declared here
void __cdecl _exit(int);
^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:140:9: error: no member named 'llabs' in the global namespace; did you
mean 'labs'?
using ::llabs;
~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:195:23: note: 'labs' declared here
__msvcrt_long __cdecl labs(__msvcrt_long);
^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:145:9: error: no member named 'lldiv' in the global namespace; did you
mean 'ldiv'?
using ::lldiv;
~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:190:16: note: 'ldiv' declared here
ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long);
^
9 errors generated.
请注意,我正在使用通过自制软件安装的wine / winelib。
从外观上看,似乎Winelib对msvcrt的实现导致Xcode的工具链爆炸。
我能做些什么来解决这个问题吗?
答案 0 :(得分:0)
这些功能的所有声明都出现在Wine 3.8中。将您的Wine副本更新到3.8或更高版本,然后重试。