对impl的未定义引用 [英] Undefined reference to impl

查看:328
本文介绍了对impl的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse上设置SFML时出现错误。我完全按照说明,但我仍然得到这些错误。我试过 TDM SJLJ MinGW DW2 - 都提供不同的未定义引用。

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.

我将动态链接到sfml

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

这是我要得到的:

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

所有未定义的引用都有前缀 _impl 。如何解决这个问题?

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

推荐答案

_imp __ 表示链接正在寻找导入的函数,这意味着它正在寻找一个动态库。

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.

由于你只是测试了两个MinGW版本,了解它应该如何工作。 MinGW构建不兼容,因此您需要确保您的库是使用您为项目使用的编译器构建的。 SFML网站上的预构建二进制文件是用旧的编译器版本构建的,我不建议使用这样的旧编译器。

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.

我建议你得到 MinGW Builds 安装程序接收一个uptodate编译器。接下来,您必须按照官方教程中所述,使用CMake构建SFML, a>,或者如果您无法正确构建,也可以使用我的每晚构建SFML ,但是您还需要确保使用相同的编译器。

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.

这篇关于对impl的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆