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]
Other format: [Raw text]

Re: In function `main':: undefined reference to ...


Graf László wrote:

Another question.
I did inherit a class Page from class Base:

and I modified the Makefile:

------------- Makefile ------------------
compile :
    g++ -c base.cpp -o base.o
    g++ -c page.cpp base.o -o page.o      <-------- this line is new
    g++ axf.cpp base.o page.o -o axf.o    <-------- added the page.o

clear :
clear
clean :
rm *.o


run :
    ./axf.o

The result is:
    rm *.o
    g++ -c base.cpp -o base.o
    g++ -c page.cpp base.o -o page.o
    g++: cannot specify -o with -c or -S and multiple compilations
    make: *** [compile] Error 1
Why?

It says exactly why. You _CANNOT_ specify -o when you are using -c. Change that to g++ -c page.cpp base.o


--


*****************************

* Sriharsha Vedurmudi

* Software Engineer

*

* Redpine Signals Inc.

* Gate #395, Plot 87,88

* Sagar Society, Road #2,

* Banjara Hills,

* Hyderabad - 500 034,

* Andhra Pradesh,

* India.

* www.redpinesignals.com

*

* +91-40-23559911 (Office)

* +91-98491-33133 (Mobile)

*****************************


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