gpt4 book ai didi

c++ - 在 C++ 中使用外部库(SVL 库)

转载 作者:行者123 更新时间:2023-11-28 05:55:40 26 4
gpt4 key购买 nike

我尝试安装 external library SVL ,这是在链接中给出的。我做了make install现在看来我可以按照 documentation 中的说明导入它使用 #include <svl/some_header_files.h>

现在我想运行我的一些程序来测试。但我正在努力。我做到了

g++ vertex.hh vertex.cc

我想要运行的程序,它给出了,

In file included from vertex.hh:9:
In file included from /usr/local/include/svl/Vec3.h:14:
/usr/local/include/svl/Vec2.h:25:10: error: unknown type name 'Real'
Vec2(Real x, Real y); // (x, y)
^
/usr/local/include/svl/Vec2.h:25:18: error: unknown type name 'Real'
Vec2(Real x, Real y); // (x, y)
^
/usr/local/include/svl/Vec2.h:27:10: error: unknown type name 'ZeroOrOne'
Vec2(ZeroOrOne k); // v[i] = vl_zero
^
/usr/local/include/svl/Vec2.h:28:10: error: unknown type name 'Axis'
Vec2(Axis k); // v[k] = 1
^
/usr/local/include/svl/Vec2.h:32:5: error: unknown type name 'Real'
Real &operator [] (Int i);
^
/usr/local/include/svl/Vec2.h:32:31: error: unknown type name 'Int'; did you mean 'int'?
Real &operator [] (Int i);

和更多类似的错误,然后是

In file included from vertex.cc:10:
In file included from /usr/local/include/svl/Vec3.h:14:
/usr/local/include/svl/Vec2.h:25:10: error: unknown type name 'Real'
Vec2(Real x, Real y); // (x, y)
^
/usr/local/include/svl/Vec2.h:25:18: error: unknown type name 'Real'
Vec2(Real x, Real y); // (x, y)
^
/usr/local/include/svl/Vec2.h:27:10: error: unknown type name 'ZeroOrOne'
Vec2(ZeroOrOne k); // v[i] = vl_zero
^

和更多类似的错误,
最后,

/usr/local/include/svl/Vec2.h:69:27: error: unknown type name 'Int'; did you mean 'int'?
Vec2 &MakeUnit(Int i, Real k = vl_one); // I[i]
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

你能告诉我这是怎么回事吗?我怎样才能解决这个问题?

这是两个文件的链接 vertex.ccvertex.hh
https://www.dropbox.com/sh/4cax5ftk2lssots/AAA62m2VnSZXqBfB65VfVqFTa?dl=0

新错误使用#include "svl/SVL.h"

In file included from vertex.hh:13:
./edge.hh:289:10: warning: unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'QuadEdge'
[-Wc++11-extensions]
friend QuadEdge;
^
class
1 warning generated.
In file included from vertex.cc:12:
In file included from ./cell.hh:9:
./edge.hh:289:10: warning: unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'QuadEdge'
[-Wc++11-extensions]
friend QuadEdge;
^
class
In file included from vertex.cc:12:
./cell.hh:293:10: warning: unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'CellVertexIterator'
[-Wc++11-extensions]

最佳答案

为什么要编译 vertex.hh?为什么不只是 g++顶点.cc

其次,您能否向我们展示一下您的头文件和源文件的内容。实际上,源文件可能是:

#include "vertex.hh"
int main() { return 0; }

和头文件:

#include "svl/SVL.h"

其次,当您说“#include”时,您只是包含了一些 SVL 内部 header 吗?那可能行不通。 http://www.cs.cmu.edu/~ajw/doc/svl.html说“对于基本用途,唯一需要的头文件是 svl/SVL.h”。

关于c++ - 在 C++ 中使用外部库(SVL 库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34199297/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com