用c++进行LEDA编程:
我是LEDA-6.3用户。 我在编译此简单代码时出错:用c++进行LEDA编程:,c++,ubuntu-10.10,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"]
#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的指南,请给我链接你可能是指LEDA::d_数组,或者忘记使用名称空间LEDA 我尝试了leda:d_数组,还使用了名称空间leda;但是还有其他一些大错误,比如us:d_array.cpp:7:error:对“string”的引用是不明确的/usr/lib/LEDA/incl/LEDA/core/string.h:58:error:候选者是:class-LEDA::string和许多其他非组织化的错误议论我现在不知道在这个平台上怎么做!这就是为什么使用被认为是邪恶的!