This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiling/Linking problem


Emmanuel Lambert wrote:
> 
> Hi,
> 
> I have 3 classes :
> 1) CGSolver in files cgsolver.cc and cgsolver.h
> 2) CGSolverForMCL, which inherits fromCGSolver, in files cgslvrfr.cc and
> cgslvrfr.h
> 3) MCL, which uses  CGSolverForMCL, in files mcl.cc and mcl.h
> 
> I was able to compile these classes successfully using
> g++ -c
> My main program constructs an MCL class and is contained in the file
> mcltrain.cc
> 
> Now, when I try to compile the main program and link everything using this
> command :
> g++ mcltrain.cc
Ah. There's you're problem.
Try: g++ -c mcltrain.cc
     g++ -o mcltrain mcltrain.o cgsolver.o cgslvrfr.o

That oughta do it.

HTH
--ag


> I get several errors.
> 
> This is my screen output :
> 
> ----------------------------------------------------
> archytas> g++ mcltrain.cc
> Undefined                       first referenced
>  symbol                             in file
> CGSolver type_info node             /esat/archytas/tmp/ccWTRpHe.o
> CGSolver::~CGSolver(void)           /esat/archytas/tmp/ccWTRpHe.o
> CGSolver::CGSolver(int, long, double *, double)/esat/archytas/tmp/ccWTRpHe.o
> CGSolver::CGSolver(void)            /esat/archytas/tmp/ccWTRpHe.o
> CGSolver type_info function         /esat/archytas/tmp/ccWTRpHe.o
> CGSolver::solve(void)               /esat/archytas/tmp/ccWTRpHe.o
> ld: fatal: Symbol referencing errors. No output written to a.out
> collect2: ld returned 1 exit status
> archytas>
> ----------------------------------------------------
> 
> What is the problem ?
> I do not understand at all why this does not compile and link.
> It works fine under Win98 and Borland C++.
> 
> Please help me out.
> 
> Thank you
> Emmanuel Lambert

-- 
Artie Gold, Austin, TX
mailto:agold@bga.com or mailto:agold@cs.utexas.edu
--
"If you come to a fork in the road, take it." L. P. Berra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]