Thread: I want to run a make file.

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    38

    I want to run a make file.

    I wish to run a make file from the command line in windows. I usually am not using windows but now I have to so how can I run a make command?

  2. #2
    Registered User
    Join Date
    Mar 2012
    Posts
    38
    I went to this website Make for Windows downloaded Complete package, except sources and tried to add it as a path variable but still does not work. Any help?

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    Doesn't work how?

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    38
    It just plain out was not working, but I found out the make command was already included in my compiler named "mingw32-make". I have another question though, I am trying to compile in gtk and it will not work. When run the make file doing mingw32-make it says I have an error "unrecognizable option '-pthread' " I tried taking it out and then it gave me an error saying in the source file of the .c program there was a fatal error gtk/gtk.h: no such file or directory complication terminated.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    "unrecognizable option -pthread" sounds like you're trying to use a UNIX makefile on Windows -- that won't work!! Apart from obvious things like 'make clean' calling 'rm' which doesn't exist on Windows, any OS specific predefines passed to the compiler will be wrong, and unsupported stuff like -phreads will be attempted. You *can't* use a UNIX makefile on Windows -- just thought I'd repeat that (unless you use Cygwin, but I haven't had 100% luck with UNIX makefiles on there either).

    Either way if you haven't already, get the Windows version:
    GTK+ Download: Windows (32-bit)

    Maybe they have an example Windows makefile you can steal from.

    Missing file error is pretty obvious: you need to set up your include paths ("-I <directory>" ) to point to gtk's include directory and the include dirs of any dependencies it has. You'll also need to fix your link line to link the gtk library. I don't really know how your makefile is laid out so can't suggest specific changes, just make a copy of it and make it Windows friendly I guess.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Are you trying to build gtk for yourself, or just build a gtk program you've written (assuming gtk installed correctly)?

    If you've got mingw installed, you should have all the basic tools you need to write makefiles, providing you have PATH setup correctly.

    Moved to tech.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    38
    The GTK program is already written by me and I know for a fact it works. The makefile also works. Here is my makefile I am confused at what I should switch.
    Code:
    
    #Makefile to compile and link the GTK+ helloworld program
    #gcc -Wall -g gtk_hello.c  `pkg-config --cflags gtk+-2.0` -o gtk_helloworld `pkg-config --libs gtk+-2.0`
    
    
    GTK_INCLUDE = -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng14
    GTK_LIB = -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
    CC = gcc -g -Wall
    
    
    gtk_calculator: gtk_calculator.c
    	$(CC) gtk_calculator.c $(GTK_INCLUDE) -o gtk_calculator $(GTK_LIB) 
    
    
    clean:
    	rm -f *.o *~ helloworld
    I believe I have GTK on this computer already.

  8. #8
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    Seriously. UNIX makefile won't work. Won't work!!!

    Code:
    -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include
    These paths after the -I are your include paths. They're where the compiler will look for file.h in #include "file.h". They're all UNIX paths though. Below it is a list of libraries to link with that may or may not be right.

    I've never used pkg-config but seems like it's the way to get this right:

    freedesktop.org - Software/pkg-config

    Instructions to use here:
    Compiling Hello World

    Maybe you already got it with the gtk installation. Anyway, run that, and replace the GTK_INCLUDE and GTK_LIB lines in the makefile with the stuff it spits out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 06-16-2008, 01:18 PM
  2. make file
    By juststartedC in forum C Programming
    Replies: 2
    Last Post: 10-20-2007, 06:14 AM
  3. How would I make a c++ prgoram make a .exe file?
    By Rune Hunter in forum C++ Programming
    Replies: 9
    Last Post: 12-26-2004, 05:56 PM
  4. Make file
    By dianazheng in forum C Programming
    Replies: 3
    Last Post: 10-18-2004, 09:59 AM
  5. How do I make a help file (*.hlp)
    By master5001 in forum Windows Programming
    Replies: 4
    Last Post: 07-16-2002, 04:15 PM