Thread: Makefile

  1. #1
    Registered User
    Join Date
    Jan 2005


    I'm doing this project with fltk as gui. I use mingw and msys as compiler, meaning regular makefiles. But I get this weird error that I just can't figure out...

    This is how my Makefile looks like:
    CC = g++
    CFLAGS = -Wall `fltk-config --cxxflags`
    OFLAGS = -Wall -lOpenGL32 `fltk-config --use-gl --ldflags`
    OBJECTFILES = gui.o infvizglib.o
    exe: $(OBJECTFILES)
    	$(CC) $(OBJECTFILES) -o finviz.exe $(OFLAGS)
    	strip -s finviz.exe
    gui.o: gui.cpp gui.h infvizglib.h
    	$(CC) -c gui.cpp $(CFLAGS)
    infviz.o: infvizglib.cpp infvizglib.h
    	$(CC) -c infvizglib.cpp $(CFLAGS)
    	rm *.o *.exe
    I get this weird error about not finding some fltk headerfile, but I don't think that's the problem. I get this printout about what's going on.
    g++ -c gui.cpp -Wall `fltk-config --cxxflags`
    g++      -c -o infvizglib.o infvizglib.cpp
    The first line gets me a good compiled gui.o file, but the second one means nothing... What could be wrong? I've looked into Makefiles and I can't find any abnormalties about my code...

    Hope for help...

  2. #2
    Registered User
    Join Date
    Aug 2003
    Gaah, the infvizglib.o target isn't defined but is dependent of exe, which means the default rule is run, and by default make uses $(CXXFLAGS) when compiling c++ source files not $(CFLAGS). If you want different behavior, either define and use CXXFLAGS, add another rule, or look in the makefile manual( there are other ways).

  3. #3
    Registered User
    Join Date
    Jan 2005
    ahh! Of course, thank you! :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. Building a project using a Makefile
    By starcatcher in forum Windows Programming
    Replies: 2
    Last Post: 11-23-2008, 11:50 PM
  3. unix makefile won't work but works in Dev C++
    By jk1998 in forum C++ Programming
    Replies: 1
    Last Post: 06-09-2007, 03:54 PM
  4. makefile blues....
    By WaterNut in forum C Programming
    Replies: 6
    Last Post: 05-30-2005, 08:22 PM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 03:32 PM