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

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

 



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 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