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

时间:2015-12-10 10:22:29

标签: c++

我尝试安装链接中提供的external library SVL。我做了make install,现在看来我可以使用#include <svl/some_header_files.h>

导入documentation中给出的内容

现在我想运行一些程序进行测试。但我正在努力解决它。我做了

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]

1 个答案:

答案 0 :(得分:1)

为什么要编译vertex.hh?为什么不呢     g ++ vertex.cc

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

| type_comment NEWLINE

和头文件:

| type_comment

其次,当你说&#34; #include&#34;你只是包括一些SVL内部标题?这可能行不通。 http://www.cs.cmu.edu/~ajw/doc/svl.html说&#34;对于基本用途,唯一需要的头文件是svl / SVL.h&#34;。