[英]SFML2 static linking error with mingw32: undefined references
I am using Code::Blocks on 64bit Windows 7, MinGW 4.7.1. 我在64位Windows 7,MinGW 4.7.1上使用Code :: Blocks。
I'm trying to get SFML 2.1 to work with MingW in codeblocks, but it's causing problems. 我正在尝试使SFML 2.1在代码块中与MingW一起使用,但这会引起问题。
when i try to compile i get these errors: 当我尝试编译时,出现以下错误:
undefined reference to
_imp___ZN2sf6StringC1EPKcRKSt6locale
对_imp___ZN2sf6StringC1EPKcRKSt6locale
未定义引用undefined reference to
_imp___ZN2sf9VideoModeC1Ejjj
对_imp___ZN2sf9VideoModeC1Ejjj
未定义引用... ...
I'm linking the following libraries: 我正在链接以下库:
What am I doing wrong? 我究竟做错了什么? The errors say undefined reference, but I have already follow these instructions step by step. 错误提示未定义参考,但是我已经逐步遵循了这些说明 。
When trying to link the static version of the library, you'll essentially have to use the static version of the headers as well (otherwise you're essentially looking for the references at the wrong place (more specifically: with the wrong format/decoration)). 尝试链接库的静态版本时,您实际上也必须使用标头的静态版本(否则,您实际上是在错误的位置查找引用(更具体地说:格式/修饰错误) ))。
As such, when linking the static version, always make sure that SFML_STATIC
is defined before you include any SFML header. 这样,在链接静态版本时,请始终确保在包含任何SFML标头之前已定义SFML_STATIC
。
Also, make sure to link the static version of the libraries (with a -s
suffixed). 另外,请确保链接库的静态版本(后缀-s
)。
SFML_STATIC
. 定义SFML_STATIC
。 SFML_STATIC
. 不要定义SFML_STATIC
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.