In function `main':: undefined reference to ...
Sriharsha
sriharsha.v@redpinesignals.com
Tue Jan 18 10:13:00 GMT 2005
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)
*****************************
More information about the Gcc-help
mailing list