help-gplusplus
[Top][All Lists]
Advanced

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

Makefile question (g++ compiling)


From: xz
Subject: Makefile question (g++ compiling)
Date: Mon, 14 Jan 2008 14:18:08 -0800 (PST)
User-agent: G2/1.0

I understand the most simple (but kinda silly) way to write a Makefile
is to simply put all related the cpp files after the colon and compile
them all, like this:

testprogram: A.cpp B.cpp C1.cpp C2.cpp test.cpp
<Tab>g++ $? -o $@

However, the wierd thing that I came across was:
Every time I run "make testprogram" for the first time, the compiler
(g
++) complaines that it cannot find the definitions of some member
functions, which I have defined in A.cpp or B.cpp

(Of course I hvae included C1.h and C2.h in test.cpp, included B.h in
C1.h, and included A.h in B.h.)

And, if I run "make testprogram" again (for the second time), then
they all compile well and the executable is just made there in good
state.

Anybody knows why that is happening?
I am using emacs and the running the compile command "make
testprogram" within emacs, I am not sure if that matters.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]