By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,403 Members | 953 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,403 IT Pros & Developers. It's quick & easy.

cppflags and make files

P: n/a
I am trying to learn C++ using "Thinking in C++" from Bruce Eckel. I
have installed cygwin and GNU make on my windows XP. The samples are
working fine.

I am trying to understand the makefile, say for Chapter 02 and I have a
few questions:

1. Where is the value set for CPPFLAGS as it is not being set in
gcc.makefile?

2. How do .exe files get created? I don't see a rule for .exe! My guess
is that there is some implicit rule which does it. I tried to run "make
-p" but didn't see any mention of .exe. If so, where can I see this
rule?
TIA

Jun 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gm****@gmail.com wrote:
I am trying to learn C++ using "Thinking in C++" from Bruce Eckel. I
have installed cygwin and GNU make on my windows XP. The samples are
working fine.

I am trying to understand the makefile, say for Chapter 02 and I have a
few questions:

1. Where is the value set for CPPFLAGS as it is not being set in
gcc.makefile?

2. How do .exe files get created? I don't see a rule for .exe! My guess
is that there is some implicit rule which does it. I tried to run "make
-p" but didn't see any mention of .exe. If so, where can I see this
rule?


These are platform-specific questions that are not related to the topic
of this newsgroup, viz. the C++ language proper. See this FAQ for what
is on-topic here and for a list of groups that might be more relevant
(you'll want a Cygwin or other UNIX-related group):

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

<OT>On Cygwin, if your input file is called a.cpp, the object file will
be a.o, and the executable will be a.exe. However, cygwin is emulating
UNIX, which doesn't have an extension for executables like DOS/Windows.
So, it is sometimes synonymous to call "a.exe" simply "a", as in a
Makefile.</OT>

Cheers! --M

Jun 28 '06 #2

P: n/a

<gm****@gmail.com> wrote:
I am trying to understand ... makefile ...
Wrong group. Try:

gnu.utils.help (I set followup to here)
comp.programming

This group is for the C++ language. But I know the answers
to your questions because I use make extensively at home,
so I'll give a brief answer.
Where is the value set for CPPFLAGS?
It aint. Set it yourself. I usually set it to:
CPPFLAGS = -I $(INCDIR) -I-
where INCDIR has been set on an earlier line to the path of my
include directory.
I don't see a rule for .exe!


There aint any. Gnu Make is a Unix tool. Unix doesn't have
*.exe files. Those are purely Microsoft. You'll have to make
your own rule. My rule is:

%.exe: %.cpp
@echo Using pattern rule %.exe:%.cpp to compile $*.cpp to $*.exe:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< $(LDFLAGS) $(LDLIBS) $(OUTPUT_OPTION)
@echo $@ is up to date.
@echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

(Where all the macros have been defined on previous lines.)

Hope that helps.

--
Cheers,
Robbie Hatley
Tustin, CA, USA
lone wolf intj at pac bell dot net
home dot pac bell dot net slant earnur slant
Jun 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.