[Stk] Cygwin & stk

Ge Wang gewang@CS.Princeton.EDU
Tue, 17 Jan 2006 13:12:23 -0500 (EST)


Greetings,

Hmm, I can't quite recall which makefile that was, but try the one at 
the end of this post.

> 1) why doesn't the system find the include files specifed in "INCLUDES"
> (I've looked carefully for typos ...)

The way the INCLUDES works in this makefile requires you to prefix each
include with -I, as in -I/cygdrive/c/a_Xfer/stk/stk-4.2.1/include, 
since the $(INCLUDES) is substituted verbatim.  the -I flag is what
gcc expects.

> 2) How can I add more than one include path to "INCLUDES" (eg - for 
cygwin)

INCLUDES=-Ifoo/bar -Ifoo/bing

> 3) If I remove the newline after "play.cpp" on line 10 I get the error
> make: *** No rule to make target `gcc', needed by `play.o'.  Stop.
> but I dont need a newline after "play.o" on line 8.  Why?

makefile rules are in the form of:

target1: dependency1 dependency2 ...
 	action

(there would be additional rules to handle dependency1 and dependency2)
In building target1, the program first ensures that dependencies 1 and 2 
have been built, before taking the action defined on the next line. 
makefile is sensitive to newlines (and even tabs in places).

In this case, without the newline we have:

play.o: play.cpp gcc -D__etc...

gcc is then taken to be something that play.o depends on, and the
program proceeds to look for a rule to build gcc, something that looks 
like:

gcc: ...
 	action

Of course, since we don't intend to build gcc, there isn't a rule that 
looks like that, and hence the errors, I think.

> play.cpp:20:20: iostream: No such file or directory

This looks suspicious since iostream should be in the default include 
path.  Try the new makefile.  If you still get this message, you may
need to (re)set the standard include path and/or (re)install your c++ 
libraries for cygwin.  Let us know how it goes.

Hope this helps.

Best,
Ge!
(makefile below)


CC=gcc
INCLUDES=-I../../include
SRC_DIR=../../src
FLAGS=-D__WINDOWS_MM__ $(INCLUDES) -O3 -c
LIBS=-lwinmm -lstdc++ -lm
OBJS=play.o Stk.o FileRead.o WvIn.o FileWvIn.o RtAudio.o

play: $(OBJS)
         $(CC) -o play.exe $(OBJS) $(LIBS)
play.o: play.cpp
         $(CC) $(FLAGS) play.cpp
Stk.o:
         $(CC) $(FLAGS) $(SRC_DIR)/$*.cpp
FileRead.o:
         $(CC) $(FLAGS) $(SRC_DIR)/$*.cpp
WvIn.o:
         $(CC) $(FLAGS) $(SRC_DIR)/$*.cpp
FileWvIn.o:
         $(CC) $(FLAGS) $(SRC_DIR)/$*.cpp
RtAudio.o:
         $(CC) $(FLAGS) $(SRC_DIR)/$*.cpp

clean:
         rm -f play.exe *~ *.o