编译一个C ++程序,它使用sfml和mingw从linux移植到windows
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译一个C ++程序,它使用sfml和mingw从linux移植到windows相关的知识,希望对你有一定的参考价值。
在尝试编译一个使用sfml但不编译的简单程序(main.cpp)时,我经常搞乱库。我真的和mingw混淆了; mingw如何使用gcc(在这种情况下为g ++)以及它如何使用库?
看一下这个:
x86_64-w64-mingw32-g++ -o app.exe main.cpp -I/usr/include/ -I/usr/include/x86_64-linux-gnu/ -lsfml-graphics -lsfml-audio -lsfml-network -lsfml-window -lsfml-system
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdint:41:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/char_traits.h:420,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/stdint.h:124:27: error: conflicting declaration ‘typedef long unsigned int uintptr_t’
typedef unsigned long int uintptr_t;
^~~~~~~~~
In file included from /usr/share/mingw-w64/include/stddef.h:7:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/stddef.h:1,
from /usr/include/wchar.h:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:38,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/crtdefs.h:75:44: note: previous declaration as ‘typedef long long unsigned int uintptr_t’
__MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
^~~~~~~~~
In file included from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9:0,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/stdlib.h:63:5: error: conflicting declaration ‘typedef struct div_t div_t’
} div_t;
^~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/stdlib.h:62:5: note: previous declaration as ‘typedef struct _div_t div_t’
} div_t;
^~~~~
In file included from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9:0,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/stdlib.h:71:5: error: conflicting declaration ‘typedef struct ldiv_t ldiv_t’
} ldiv_t;
^~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/stdlib.h:67:5: note: previous declaration as ‘typedef struct _ldiv_t ldiv_t’
} ldiv_t;
^~~~~~
In file included from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9:0,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/stdlib.h:83:5: error: conflicting declaration ‘typedef struct lldiv_t lldiv_t’
} lldiv_t;
^~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/stdlib.h:653:61: note: previous declaration as ‘typedef struct lldiv_t lldiv_t’
typedef struct { __MINGW_EXTENSION long long quot, rem; } lldiv_t;
^~~~~~~
In file included from /usr/include/stdlib.h:291:0,
from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/x86_64-linux-gnu/sys/types.h:109:19: error: conflicting declaration ‘typedef __ssize_t ssize_t’
typedef __ssize_t ssize_t;
^~~~~~~
In file included from /usr/share/mingw-w64/include/stddef.h:7:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/stddef.h:1,
from /usr/include/wchar.h:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:38,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/crtdefs.h:45:35: note: previous declaration as ‘typedef long long int ssize_t’
__MINGW_EXTENSION typedef __int64 ssize_t;
^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:130:0,
from /usr/include/stdlib.h:291,
from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/types/time_t.h:8:18: error: conflicting declaration ‘typedef __time_t time_t’
typedef __time_t time_t;
^~~~~~
In file included from /usr/share/mingw-w64/include/stddef.h:7:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/stddef.h:1,
from /usr/include/wchar.h:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:38,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/crtdefs.h:138:20: note: previous declaration as ‘typedef __time64_t time_t’
typedef __time64_t time_t;
^~~~~~
In file included from /usr/share/mingw-w64/include/sec_api/stdlib_s.h:9:0,
from /usr/share/mingw-w64/include/stdlib.h:694,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/stdlib.h:555:12: error: conflicting declaration of C function ‘int putenv(char*)’
extern int putenv (char *__string) __THROW __nonnull ((1));
^~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/stdlib.h:639:15: note: previous declaration ‘int putenv(const char*)’
int __cdecl putenv(const char *_EnvString) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
^~~~~~
In file included from /usr/include/stdio.h:856:0,
from /usr/include/malloc.h:24,
from /usr/share/mingw-w64/include/stdlib.h:695,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:27:38: error: conflicting declaration ‘const char* const _sys_errlist []’
extern const char *const sys_errlist[];
^
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cstdlib:75:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_string.h:5417,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/string:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:42,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/stdlib.h:164:38: note: previous declaration as ‘char* _sys_errlist [1]’
extern __declspec(dllimport) char *_sys_errlist[1];
^~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cwctype:50:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/locale_facets.h:39,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/basic_ios.h:37,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:44,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/include/wctype.h:52:27: error: conflicting declaration ‘typedef long unsigned int wctype_t’
typedef unsigned long int wctype_t;
^~~~~~~~
In file included from /usr/share/mingw-w64/include/stddef.h:7:0,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/stddef.h:1,
from /usr/include/wchar.h:52,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ios:38,
from /usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/include/c++/ostream:38,
from /usr/include/SFML/System/Err.hpp:32,
from /usr/include/SFML/System.hpp:34,
from /usr/include/SFML/Window.hpp:32,
from /usr/include/SFML/Graphics.hpp:32,
from main.cpp:1:
/usr/share/mingw-w64/include/crtdefs.h:107:24: note: previous declaration as ‘typedef short unsigned int wctype_t’
typedef unsigned short wctype_t;
它需要来自/usr/include
和/usr/include/x86_64-linux-gnu/
的文件,但现在它显示了所有这些错误...我已经成功编译了一个程序,它使用在linux中运行的sfml和一个在windows中运行的简单(仅限std lib)程序,但我可以'使这个(使用sfml的c ++程序)为windows编译。请注意,我的操作系统是debian linux发行版。
这个问题与SFML本身无关。
您的交叉编译环境有问题,因为编译器将MinGW(例如/usr/share/mingw-w64/include/stdlib.h
)中的文件与主机系统中的文件(例如/usr/include/stdlib.h
)混合在一起。
你有没有特别的理由通过-I/usr/include/ -I/usr/include/x86_64-linux-gnu/
?这是错误的,因为这些是特定于Linux的,而不是MinGW的正确版本。
您还必须交叉编译SFML并将其安装在某个地方,而不是直接安装在常规的/usr/
路径中,如果那些指向SFML的话。
我建议您将SFML安装到/usr/share/mingw-w64
,因为这应该允许MinGW开箱即可获取正确的文件,而无需提供路径。
以上是关于编译一个C ++程序,它使用sfml和mingw从linux移植到windows的主要内容,如果未能解决你的问题,请参考以下文章