We help IT Professionals succeed at work.
Get Started

A C++ program.

QRFOA
QRFOA asked
on
149 Views
Last Modified: 2015-03-12
I have a lists.cpp file that contains 2 classes, a Link class (which creates the nodes) and a LinkedList class to create linked lists using the Link class.  I have a .h file that includes the prototypes for all the functions I want to use on my linked lists, for example, append, next, getValue, etc.  I want to write a separate driver.cpp to check the various functions are working correctly.  I understand that I should include the .h file in the driver.cpp file. I was told to compile the lists.cpp file and the driver.cpp file separately, both including the .h file and then link them together using the following code:  g++ -c -o lists.o lists.cpp, g++ -c -o driver.o driver.cpp, and g++ -o exec lists.o driver.o.  Here is my question:  How can I create a linked list (LinkedList* actlist = new LinkedList) in the driver.cpp when classes are not included in the .h file?  I need a linked list in order to check that the functions are working.
Comment
Watch Question
Top Expert 2013
Commented:
This problem has been solved!
Unlock 2 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE