How to make a dynamically linked executable file?

So I have a file called queens.cc and I need to do the following:

  1. Compile and make a .o file while specifying that the compiler is to search /student/214/include for system include files.
  2. Use g++, link and load .o file to make a dynamically linked executable file called queens and to also search the directory /student/214/lib.

I have my include files located in /student/214/include and a dynamically linked library in /student/214/lib/libqueens

This is what I've tried:

g++ -c -o queens.o queens.cc -I/student/214/include

Which gives me

queens.o queens.cc

For the second part this is what I've tried:

g++ -o queens queens.cc -L/student/214/lib/libqueens

I'm stuck on how to link and load queens.o to produce a dynamically linked executable file, how can I do this? Did I compile my .o file incorrectly? Any help is appreciated. Thanks.

---------- Post updated at 07:53 PM ---------- Previous update was at 06:35 PM ----------

Nevermind I figured it out.
I used:

g++ -L/student/214/lib -I/student/214/include -Wall -o queens queens.cc -lqueens

to make an executable.

Thanks for sharing your findings and/or solution.

NEVERTHELESS:

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.