Question about how to compile multiple files with g++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 
I have a problem to compile multiple files together using GNU g++, so please 
everybody give 
me a help, thanks! 

We assume there are five files: 

main.cpp : the main function 
a.h      : the header file of class A 
a.cpp    : the definition of class A 
b.h      : the header file of class B 
b.cpp    : the definition of class B 

In the program, main.cpp uses class A (thus including a.h) and class A uses 
class B (thus including b.h). 

So, how do I compile this program to generate the objective file? 

I tried to use the following command, but it feedbacked the error "undefined 
reference to ~(objects in class A and B)". 
command: g++ -Wall -O2 -s main.cpp

ps. running platform: FreeBSD/i386 system 
    compiler: gcc version 3.2.1 

Yen

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux