簡體   English   中英

使用C ++中的外部庫(SVL庫)

[英]Working with external library in C++ (SVL library)

我嘗試安裝鏈接中提供的外部庫SVL 我確實make install ,現在看來可以使用#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 ++ vertex.cc

其次,能否向我們展示您的頭文件和源文件的內容。 實際上,源文件可能是:

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

和頭文件:

#include "svl/SVL.h"

其次,當您說“ #include”時,您是否只是包括一些SVL內部標頭? 那可能行不通。 http://www.cs.cmu.edu/~ajw/doc/svl.html說:“對於基本用途,唯一需要的頭文件是svl / SVL.h”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM