Thread: makefile help

  1. #1
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455

    makefile help

    heres my current makefile (took out the rules for install and clean since theyre kinda irrelevant

    #
    # Makefile.mingw
    #
    # Description: Makefile for win32 (mingw) version of Gaim Plugins
    #

    #
    # PATHS
    #

    GAIM_PLUGINS := .
    GAIM_TOP := ..
    ROOT_DIR := ../../win32-dev
    GTK_TOP := ../../win32-dev/gtk_2_0
    OSCAR_ROOT := ../src/protocols/oscar
    GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir
    TICKER := ./ticker
    TRANSPARENCY := ./win32/transparency
    WINPREFS := ./win32/winprefs
    PERL_PLUGIN_LOADER := ./perl
    DOCKLET := ./docklet

    ##
    ## VARIABLE DEFINITIONS
    ##

    # Compiler Options

    CFLAGS =

    DEFINES =

    .SUFFIXES:
    .SUFFIXES: .c .dll

    ##
    ## INCLUDE MAKEFILES
    ##

    include $(GAIM_TOP)/src/win32/global.mak

    ##
    ## INCLUDE PATHS
    ##

    INCLUDE_PATHS += -I$(OSCAR_ROOT) \
    -I$(GTK_TOP)/include \
    -I$(GTK_TOP)/include/gtk-2.0 \
    -I$(GTK_TOP)/include/glib-2.0 \
    -I$(GTK_TOP)/include/pango-1.0 \
    -I$(GTK_TOP)/include/atk-1.0 \
    -I$(GTK_TOP)/lib/glib-2.0/include \
    -I$(GTK_TOP)/lib/gtk-2.0/include \
    -I$(GAIM_TOP) \
    -I$(GAIM_TOP)/src \
    -I$(GAIM_TOP)/src/win32 \



    LIB_PATHS = -L$(GTK_TOP)/lib \
    -L$(GAIM_TOP)/src \


    ##
    ## LIBRARIES
    ##

    LIBS = -lgtk-win32-2.0 \
    -lglib-2.0 \
    -lgdk-win32-2.0 \
    -lgobject-2.0 \
    -lgmodule-2.0 \
    -lgdk_pixbuf-2.0 \
    -lpango-1.0 \
    -lintl \
    -lws2_32 \
    -lgaim


    ##
    ## RULES
    ##

    ##
    ## TARGET DEFINITIONS
    ##

    .PHONY: all clean

    all: plugins
    $(MAKE) -C $(TICKER) -f Makefile.mingw
    $(MAKE) -C $(WINPREFS) -f Makefile.mingw
    $(MAKE) -C $(TRANSPARENCY) -f Makefile.mingw
    $(MAKE) -C $(PERL_PLUGIN_LOADER) -f Makefile.mingw
    $(MAKE) -C $(DOCKLET) -f Makefile.mingw

    #
    # BUILD Plugin
    #

    .c.dll:
    $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o [email protected] -c $<
    $(CC) -shared [email protected] $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@

    plugins: \
    autorecon.dll \
    history.dll \
    iconaway.dll \
    idle.dll \
    spellchk.dll \
    statenotify.dll \
    alice.dll \
    timestamp.dll


    i have 3 header files and their counterpart c files. i have them #included' into my main file, but when i try to compile through mingw on cygwin, it says


    alice.dll.o(.text+0x2c3):alice.c: undefined reference to `initialize'
    C:\cygwin\bin\make.exe: *** [alice.dll] Error 1


    theres no errors in the source files. so i guess its a makefile problem. i cant figure it out, ive been looking it up for about an hour now.

    ideas?
    thanks

    oh yeah - im also compiling on windows using mingw under cygwin. i think i mentioned that already. oh well.
    Last edited by the Wookie; 10-10-2003 at 06:36 PM.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>alice.c: undefined reference to `initialize'
    means alice.c has a reference to a variable (or function) called "initialize" that isn't defined anywhere. Is it in an external file or something?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    its declared in the .h file and then the function itself is in the .h file. perhaps its an overloading issue. the problem with this thing is that its not in a class, spread out in .h files, same thing with gaim.

    i also noticed it says this:
    alice.c:114: warning: implicit declaration of function `initialize'

    so i guess an overloading issue? ill try adding another parameter to it and see if that helps..

    thanks

  4. #4
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    tried that. no workie

    alice.dll.o(.text+0x2c5):alice.c: undefined reference to `initialize'


    and it also only says it while linking =\
    Last edited by the Wookie; 10-10-2003 at 08:06 PM.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Post some code to show the implementation of initialize and it be called.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    ok

    in alice.c

    PHP Code:
    static void init_plugin(GaimPlugin *plugin) {

        
    void *conv_handle gaim_conversations_get_handle();

        
    //alice
        
    if(initialize("C:/alice/data/alice.ini"0)!=0){
            
    MessageBox(NULL,"Could not initilize ALICE""Error"MB_OK);
        }

        
    gaim_signal_connect(conv_handle"received-im-msg"pluginGAIM_CALLBACK(im_recv_im), NULL);
        
    gaim_signal_connect(conv_handle"displayed_im_msg"pluginGAIM_CALLBACK(disp_msg), NULL);

    alice_core.h
    PHP Code:
    int initialize(char *init_fileint crap); 
    alice_core.c
    PHP Code:
    int initialize(char *init_fileint crap){
       ...


  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You said:
    its declared in the .h file and then the function itself is in the .h file.
    Now you post code showing that initialize() is in the .h file, with the function itself in a .c file. What's going there??

    Also, are you writing C or CPP? Your file extensions should be set accordingly.

    Anyway, assuming the situation is as how you've posted the code, the object modules from the compilation of alice.c and alice_core.c need to be linked together. On the command line you'd go something like this:
    Code:
    gcc -o myprog alice.c alice_core.c
    
    or
    
    gcc -c alice.c
    gcc -c alice_core.c
    gcc -o myprog alice.o alice_core.o
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    well, im not sure. in the core gaim source files, all of the prototypes are in the header files, and the definitions are in the corresponding c file

    its c code. all of the extensions check out.

    so how would i do that in the makefile. theres about 5 or 6 other alice_*.c/.h files that also need to be linked. looking at the makefile it should automatically be adding them. if i move the location of the alice_*.? files, it still gives the same error. like if i move them into the same folder where its getting the other files to link from (like in the win_32-dev folder). thats whats confusing me


    ill try copying eerything from the .h into the .c
    Last edited by the Wookie; 10-12-2003 at 06:58 PM.

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    The compiler doesn't know that alice.o and alice_core.o need linking unless you explicitly tell it.

    Checkout a basic make tutorial:
    http://www.eng.hawaii.edu/Tutor/Make/
    http://www.eng.hawaii.edu/Tutor/Make/3-2.html
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  10. #10
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    thanks, ill check those out

  11. #11
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    .c.dll:
    $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o [email protected] -c $<
    $(CC) -shared [email protected] $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@
    thats the closest thing i see to building anything, and it seems like its recursively going through the directories and building everything. i added the path to alice and its stuff into the INCLUDE_PATHS, and its still giving the error. ill try building it from scratch, but i have like no idea what im doing.

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