简体   繁体   English

使用来自 linux 终端的外部库编译 c++ 文件

[英]Compile c++ file using external library from linux terminal

I have the following files:我有以下文件:

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

and I want to make it use the library (openmesh library) on the following path:我想让它在以下路径上使用库(openmesh 库):

home/xyz/Downloads/OpenMesh-2.3/src/OpenMesh/主页/xyz/下载/OpenMesh-2.3/src/OpenMesh/

I'm trying to execute it with this:我试图用这个来执行它:

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

but no luck, output is:但没有运气,输出是:

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.在 ex1.cpp:17:0 包含的文件中:ex1.h:28:38:致命错误:OpenMesh/Core/IO/MeshIO.hh:没有这样的文件或目录编译终止。

what is the correct way of doing this?这样做的正确方法是什么?

Thanks!谢谢!

You need to put -I path on the command line.您需要将-I path放在命令行上。 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

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

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