如何包含 draco_dec 库? [英] how to include the draco_dec library?

查看:38
本文介绍了如何包含 draco_dec 库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的 c++ 项目包含 draco 库,并且我在 ubuntu 上使用 cmake 构建了 draco.当我尝试添加任何 draco 标头时,我看到包含错误".我尝试编译头文件,此命令适用于一些 drace 头文件,但没有找到很多.

I want to include the draco library for my c++ project and I built draco with cmake on ubuntu. When i try to add any draco header i see "include errors". I've tried to compile header file and this command worked for some drace headers but didnt find many on them.

g++ -I "\\wsl$\Ubuntu\home\antmedia\draco\src\draco" ObjContainer.cpp

错误:" 没有这样的文件或目录#include "draco/compression/config/compression_shared.h"

error: " No such file or directory #include "draco/compression/config/compression_shared.h"

我在 draco 自述文件中看到了这个.但我没有得到它.

I saw this in draco readme. But i did not get it.

如果您想为您的应用程序添加解码功能,您需要包含 draco_dec 库."

" If you'd like to add decoding to your applications you will need to include the draco_dec library. "

什么意思?如何添加 draco_dec 库?

What does it means? How can i add draco_dec liblary?

之后,尝试 - v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
COLLECT_GCC_OPTIONS='-I' '~localinclude' '-L~locallib' '-o' 'prog' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -quiet -v -I ~localinclude -imultiarch x86_64-linux-gnu -D_GNU_SOURCE ObjContainer.cpp -quiet -dumpbase ObjContainer.cpp -mtune=generic -march=x86-64 -auxbase ObjContainer -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cci0iuOa.s
GNU C++14 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)
        compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "~localinclude"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/7
 /usr/include/x86_64-linux-gnu/c++/7
 /usr/include/c++/7/backward
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++14 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)
        compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3eb3dc290cd5714c3e1c3ae751116f07
In file included from ObjContainer.cpp:11:0:
ObjContainer.h:11:10: fatal error: draco/compression/encode.h: No such file or directory
 #include "draco/compression/encode.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

推荐答案

为方便起见,请将下载的库安装在一个目录中,所有您自己下载和编译的库都保存在该目录中.首先创建这样一个目录.示例:

For convenience, install the downloaded library in a directory where you keep all the libraries you download and compile yourself. Start by creating such a directory. Example:

  • mkdir ~/local

然后您需要在构建之前配置要安装在该位置的 Draco 项目.在 draco/build_dir 目录中,执行:

You then need to configure the Draco project to be installed in that location before building. Inside the draco/build_dir directory, do:

  • cmake -DCMAKE_INSTALL_PREFIX=~/local ..

在执行上面的 cmake 之后,您应该 make(或 make -j 以使其更快)来构建库,然后您可以同时结合安装结果:

After you've executed cmake above you should make (or make -j to make it faster) to build the libraries and you can combine that with installing the result at the same time:

  • make -j install

Draco 创建了三个库:

Draco creates three libraries:

  • 德拉科
  • 解码器
  • 龙猫

draco_dec 可能是旧名称(或拼写错误),因此通过添加编译器选项 包含 dracodec-ldracodecg++ 行的末尾.

draco_dec mentioned in the README is probably an old name (or a typo) so include dracodec by adding the compiler option -ldracodec at the end of your g++ line.

编译自己的代码时.添加 -I 指向新创建的 include 目录和 -L 指向新创建的库的存储位置:

When compiling your own code. Add -I to point at the newly created include directory and -L to point at where the newly created libraries are stored:

  • g++ -I "\\wsl$\Ubuntu\home\antmedia\local\include" -L "\\wsl$\Ubuntu\home\antmedia\local\lib" -o prog ObjContainer.cpp -ldracodec

\\wsl$ 路径仅在您尝试从 Windows 访问 wsl 目录(例如 CMD.EXE窗口).如果您尝试从 wsl 中编译 ObjContainer.cpp,请改为像这样编译您自己的代码:

The \\wsl$ paths should only be used if you're trying to access your wsl directory from Windows (e.g. a CMD.EXE window). If you are trying to compile ObjContainer.cpp from within the wsl, compile your own code like this instead:

  • g++ -I ~/local/include -L ~/local/lib -o prog ObjContainer.cpp -ldracodec

始终将您使用 cmakemake 构建的外部库安装在您家 (~/local) 的同一目录中可以对安装在那里的所有内容使用相同的两个 -I-L 选项.

By always installing the external libraries that you build using cmake and make in the same directory in your home (~/local) you can use the same two -I and -L options for everything you've installed there.

这篇关于如何包含 draco_dec 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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