vijay13@ubuntu:~/Downloads$ g++ -o test test.cpp -I /home/vijay13/Downloads/OGDF-snapshot/include/
I am getting following error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
vijay13@ubuntu:~/Downloads$ g++ -o test test.cpp -I /home/vijay13/Downloads/OGDF-snapshot/include/
/tmp/ccPE8nCu.o: In function `main':
test.cpp:(.text+0x26): undefined reference to `ogdf::Graph::Graph()'
test.cpp:(.text+0x3f): undefined reference to `ogdf::randomSimpleGraph(ogdf::Graph&, int, int)'
test.cpp:(.text+0x67): undefined reference to `ogdf::AcyclicSubgraphModule::callAndReverse(ogdf::Graph&)'
test.cpp:(.text+0x7b): undefined reference to `ogdf::GraphIO::writeGML(ogdf::Graph const&, charconst*)'
test.cpp:(.text+0x9e): undefined reference to `ogdf::Graph::~Graph()'
test.cpp:(.text+0xd7): undefined reference to `ogdf::Graph::~Graph()'
/tmp/ccPE8nCu.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x139): undefined reference to `ogdf::Initialization::Initialization()'
test.cpp:(.text+0x13e): undefined reference to `ogdf::Initialization::~Initialization()'
/tmp/ccPE8nCu.o: In function `ogdf::DfsAcyclicSubgraph::DfsAcyclicSubgraph()':
test.cpp:(.text._ZN4ogdf18DfsAcyclicSubgraphC2Ev[_ZN4ogdf18DfsAcyclicSubgraphC5Ev]+0x1f): undefined reference to `vtable for ogdf::DfsAcyclicSubgraph'
/tmp/ccPE8nCu.o: In function `ogdf::DfsAcyclicSubgraph::~DfsAcyclicSubgraph()':
test.cpp:(.text._ZN4ogdf18DfsAcyclicSubgraphD2Ev[_ZN4ogdf18DfsAcyclicSubgraphD5Ev]+0x13): undefined reference to `vtable for ogdf::DfsAcyclicSubgraph'
collect2: ld returned 1 exit status
Please Please help me solve this.
Thanks in advance
Undefined reference is a linker error.
It's not a compile error. #includes don't help.
You did not define the thing in the error message, you forgot to link the file that defines it, you forgot to link to the library that defines it, or, if it's a static library, you have the wrong order on the linker command line.
Check which one. (Note that some linkers call it an unresolved external)