Linking with given .a?

I have a homework project and was given a .a file to link with my executable to include a testing class in the program.

Basically, in main.cpp, I include "polyTester.h".

In my makefile, I tell main.o to rely on polyTester.o, and have polyTester.o make from polyTester.cc and polyTester.h

Problem is, I get unresolved linking problems when I make, and can't figure out how to link the given .a that it says to include.

Directions from the given file:

"When you build your executable, you must then link with both
* polyTester.o and libcpoly.a (in that order, after the object files
* that rely on the tester)
"

Any help?
Something like this?
g++ main.cpp -lcpoly -L<path to libcpoly.a>
If I do

g++ main.cpp poly.cc ( class implementation file) polyTester.cc (given file ) I get unresolved linking errors.

So I then have main.o and poly.o. Then I tried doing

g++ -L main.o poly.o polytester.o libcpoly.a and get undefined reference to main, which yes, is in main.cpp.

What now?
Last edited on
Topic archived. No new replies allowed.