Undefined reference to impl

99封情书 提交于 2019-12-25 01:27:54

问题


I'm getting errors setting up SFML on Eclipse. I was following the instructions perfectly but I'm still getting these errors. I've tried TDM SJLJ and MinGW DW2 - both give different undefined references.

I am linking dynamically with the sfml libraries, and I've set the path to the libraries correctly.

Here's one that I'm getting:

undefined reference to `_imp___ZN2sf6Window5closeEv' SFMLHelloWorld.cpp /SFMLHelloWorld/src line 15 C/C++ Problem

All of the undefined references have the prefix _impl on them. How do I fix this?


回答1:


As mentioned in the comments _imp__ indicates that the link is looking for an imported function, meaning it's looking for a the dynamic library.

Since you simply tested both of the MinGW versions, I assume you don't understand how its supposed to work. MinGW builds are not compatible as such you need to make sure your libraries have been built with the compiler you're using for the project. The pre-built binaries on the SFML website have been built with older compiler versions and I can't advise using such an old compiler.

I suggest you get the MinGW Builds installer to receive an uptodate compiler. Next you have to either build SFML with CMake as described in the official tutorial or if you can't get it to build properly, you can also use my Nightly Builds of SFML, but again you need to make sure that you use the same compiler.



来源:https://stackoverflow.com/questions/26220496/undefined-reference-to-impl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!