954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem splitting c++ program

Hi,

I am currently working on a program that compiles fine and runs OK to give some results. However, when I try to split the program into 3 parts, it it gives some weird compilation errors. Initially I had one program, calc.cpp that manipulates polynomials (adds/ subtract/multiply them). However when I split the program into three, polynomial.h, polynomial.cpp and calc.cpp I get complilation errors. Calc.cpp has polynomial.h included. Yet, when I call functions from polynomial.h it gives the following errors like it can't find the functions from polynomial.h. getpoly, add, compare, print are all functions in polynomial.h that I am trying to call. Any help would be appreciated. I can send the code if you would like to see it. I'm really stuck here...help!!

Errors on the compiler and linker output:
C:\DOCUME~1\saffyy\LOCALS~1\Temp\ccgVcaaa.o(.text+0x54f):calc.cpp: undefined reference to `getpoly(basic_string, __default_alloc_template<0, 0> >, list > &, bool &)'
C:\DOCUME~1\saffyy\LOCALS~1\Temp\ccgVcaaa.o(.text+0x5c0):calc.cpp: undefined reference to `compare(polyInfo const &, polyInfo const &)'
C:\DOCUME~1\saffyy\LOCALS~1\Temp\ccgVcaaa.o(.text+0x8a6):calc.cpp: undefined reference to `add(list > const &, list >)'
C:\DOCUME~1\saffyy\LOCALS~1\Temp\ccgVcaaa.o(.text+0xaec):calc.cpp: undefined reference to `print(list > const &)'

beginner
Newbie Poster
1 post since Nov 2003
Reputation Points: 10
Solved Threads: 0
 

Have you checked you include statements? Are they appropriately set, spelling and all?

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You