Thread: Strange error when compile C program using makefile

  1. #1
    Registered User
    Join Date
    Apr 2017
    Posts
    51

    Strange error when compile C program using makefile

    below is my makefile to compile C program:
    Code:
    CC = cc
    CFLAGS  = $(DEBUG) -O -q64 \
            -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public \
            -I$(ORACLE_HOME)/network/public -I$(ORACLE_HOME)/precomp/public -I$(ORAC
    LE_HOME)/plsql/public \
            -I. -I../inc \
            -I$(MQM_HOME)/inc \
            -I/usr/include -I/usr/xlc/include \
            -I/usr/vacpp/include \
    ORACLE_LIBPATH=-L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib
    
    ORACLE_LIBS=-lclntsh -lm
    MQ_LIBPATH=-L$(MQM_HOME)/lib64
    MQLIB = $(MQ_LIBPATH) -lmqm -lmqmcs -lmqmzse
    
    LIBS   =  $(MQLIB) $(ORACLE_LIBS) -lm -lpthreads
    
    LDFLAGS = -q64 $(MQ_LIBPATH) $(ORACLE_LIBPATH)
    SOURCE=../src
    EXE     = $(SOURCE)/fin2ici
    MAIN    =  $(SOURCE)/fin2ici.c
    OBJS = $(SOURCE)/fin2ici.o $(SOURCE)/dte_mq.o
    #.SUFFIXES: .c .o
    # Compilation rules
    .c.o:
            #$(CC) $(CFLAGS) -c -o ${<:.c=.o} $<
            $(CC) $(CFLAAG) .c.o: c89 -c -o $<
    all:    $(OBJS) $(EXE)
            @if [ -z "$(DEBUG)" ];\
            then \
                    echo "Copying files to bin directory"; \
                    cp $(EXE) ../bin; \
                    rm -f $(OBJS); \
                    rm -f ${MAIN:.c=.o}; \
            fi;
     @echo "Done"
    $(EXE): $(OBJS) ${MAIN:.c=.o}
            $(CC) $(LDFLAGS) -o $(EXE) $(OBJS) ${MAIN:.c=.o} $(LIBS)
            cp $(EXE) ../bin
            \rm -f $(OBJS)
            \rm -f $(EXE)
    clean:
            \rm -f $(OBJS)
            \rm -f $(EXE)
    when I run makefile, it gives an error:
    ld: 0711-738 ERROR: Input file ../src/fin2ici.o:
    XCOFF32 object files are not allowed in 64-bit mode.

    Can anybody let me know where is an error

    Thanks





    [/code]

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Code:
    $(CC) $(CFLAAG) .c.o: c89 -c -o $<
    You misspelled CFLAGS

    Edit: Remember to do a clean to delete the 32 bit object files

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    Tim,
    it shows the same result. That mean error is somewhere else.
    Could you check again?
    I am working on UNIX AIX

    Thanks

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Post the current makefile; if you still have the issue after you manually delete all the object files and and created libraries.

    Edit: Also, post the command used to compile and link the object file in the error message.

    Tim S.
    Last edited by stahta01; 01-03-2018 at 02:08 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error in makefile when compile C program
    By digioleg54 in forum C Programming
    Replies: 10
    Last Post: 12-23-2017, 11:42 AM
  2. Compile error with Makefile...
    By LockTim in forum C++ Programming
    Replies: 3
    Last Post: 09-11-2013, 11:04 AM
  3. A Strange Compile Error
    By Reisswolf in forum Tech Board
    Replies: 4
    Last Post: 10-05-2006, 09:56 AM
  4. Using a makefile to compile a program using SDL
    By Noerbo in forum Game Programming
    Replies: 9
    Last Post: 04-30-2006, 09:11 AM
  5. Strange MSVC winsock2 compile error
    By LuckY in forum Windows Programming
    Replies: 3
    Last Post: 06-28-2003, 08:18 AM

Tags for this Thread