Makefile

This is a discussion on Makefile within the C++ Programming forums, part of the General Programming Boards category; I'm doing this project with fltk as gui. I use mingw and msys as compiler, meaning regular makefiles. But I ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    15

    Makefile

    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:
    Code:
    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)
    
    clean:
    	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.
    Code:
    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
    Posts
    470
    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
    Posts
    15
    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, 10: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, 04:54 PM
  4. makefile blues....
    By WaterNut in forum C Programming
    Replies: 6
    Last Post: 05-30-2005, 09:22 PM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 04:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21