简体   繁体   English

如何让编译器读取下载的库?

[英]How do I get the compiler to read a downloaded library?

I've downloaded OpenMesh for Linux Ubuntu.我已经为 Linux Ubuntu 下载了 OpenMesh。 I successfuly compiled it following instructions at我按照以下说明成功编译了它

https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04067.html https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04067.html

using cmake, then make.使用 cmake,然后制作。 The result is a "build" folder containing, among other things, a makefile and.o files.结果是一个“构建”文件夹,其中包含 makefile 和.o 文件等。 I want to use OpenMesh in QT Creator, so I put an example code found on their website at我想在 QT Creator 中使用 OpenMesh,所以我在他们的网站上放了一个示例代码

https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04088.html https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04088.html

basically it just displays a cube using cout and data structures I've downloaded.基本上它只是使用我下载的 cout 和数据结构显示一个多维数据集。 However, there are compilation errors of type "undefined reference to" everywhere.但是,到处都有“未定义的引用”类型的编译错误。

Here is an example: "../OpenMesh-8.1/src/OpenMesh/Core/Mesh/ArrayKernel.hh:154: error: undefined reference to `OpenMesh::ArrayKernel::is_valid_handle(OpenMesh::HalfedgeHandle) const'这是一个示例:“../OpenMesh-8.1/src/OpenMesh/Core/Mesh/ArrayKernel.hh:154: 错误:未定义引用 `OpenMesh::ArrayKernel::is_valid_handle(OpenMesh::HalfedgeHandle) const'

I think that this could be caused because I didn't tell the compiler somehow where I compiled OpenMesh, because someone else got this error at https://linuxfr.org/forums/programmation-c/posts/openmesh我认为这可能是因为我没有以某种方式告诉编译器我在哪里编译 OpenMesh,因为其他人在https://linuxfr.org/forums/programmation-c/posts/openmesh得到了这个错误

I don't really get it, though, and I don't know much about the compiling process.不过,我真的不明白,而且我对编译过程也不太了解。 I don't know how to import downloaded libraries and run them in QT.我不知道如何导入下载的库并在 QT 中运行它们。 Does anyone know a simple way to do this?有谁知道一个简单的方法来做到这一点? Any help would be really appreciated.任何帮助将非常感激。

The correct way to do it is to open CmakeLists.txt in qt creator, which organizes everything correctly.正确的做法是在 qt creator 中打开CmakeLists.txt ,它可以正确组织所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM