从Linux终端使用外部库编译C ++文件 [英] Compile c++ file using external library from linux terminal

查看:220
本文介绍了从Linux终端使用外部库编译C ++文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下文件:

ex1.cpp    ex1.h
GLee.cpp   GLee.h

,我想让它使用以下路径上的库(openmesh库):

and I want to make it use the library (openmesh library) on the following path:


home / xyz / Downloads / OpenMesh-2.3 / src / OpenMesh /

home/xyz/Downloads/OpenMesh-2.3/src/OpenMesh/

我正在尝试用以下命令执行它:

I'm trying to execute it with this:

g++ -Wall -o ex1 ex1.cpp GLee.cpp -L/..path../

但没有运气,输出为:

在ex1.cpp:17:0中包含的文件中:
ex1.h:28:38:致命错误:OpenMesh / Core / IO / MeshIO.hh:否这样文件或目录
编译终止。

In file included from ex1.cpp:17:0: ex1.h:28:38: fatal error: OpenMesh/Core/IO/MeshIO.hh: No such file or directory compilation terminated.

这样做的正确方法是什么?

what is the correct way of doing this?

谢谢!

推荐答案

您需要在命令行上放置 -I路径 。因此,从错误看来,您将执行以下操作:

You need to put -I path on the command line. So from the error, it looks like you would do:

g++ -Wall -o ex1 ex1.cpp GLee.cpp -I /home/xyz/Downloads/OpenMesh-2.3/src

这篇关于从Linux终端使用外部库编译C ++文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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