使用c ++进行LEDA编程:

时间:2011-06-19 14:12:02

标签: c++ ubuntu-10.10

我是LEDA-6.3用户。 编译这个简单代码时出错:

#include <LEDA/core/d_array.h>
#include <iostream>
using namespace std;
main()
{ 
  d_array<string,string> dic;

  dic["hello"] = "hallo";
  dic["world"] = "Welt";
  dic["book"]  = "Buch";
  dic["key"]   = "Schluessel";

  string s;
  forall_defined(s,dic) cout << s << "  " << dic[s] << endl;
}

G ++编译器:

g++  -I$LEDAROOT/incl -L$LEDAROOT d_array.cpp /usr/lib/LEDA/libleda.a -lX11 -lm -o d_array

错误:

d_array.cpp: In function ‘int main()’:
d_array.cpp:8: error: ‘d_array’ was not declared in this scope
d_array.cpp:8: error: expected primary-expression before ‘,’ token
d_array.cpp:8: error: expected primary-expression before ‘>’ token
d_array.cpp:8: error: ‘dic’ was not declared in this scope

如果有LEDA-6.3的指南,请给我链接

1 个答案:

答案 0 :(得分:0)

您可能意味着leda::d_array或忘记了using namespace leda;