Thread: unix makefile won't work but works in Dev C++

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    42

    unix makefile won't work but works in Dev C++

    I have three file impletment.cc , main.cc and student.h.

    Here is my makefile

    Code:
    CC = g++
    
    student_record: main.o impletment.o
    	$(CC) -o main.o impletment.o 
    
    main.o: main.cc student.h
    	$(CC) -c main.cc
    
    impletment.o: impletment.cc student.h
    	$(CC) -c impletment.cc
    
    clean:
    	rm -f*.o core student_record
    I am able to compile my files without error using Dev C++ which I don't have to write a makefile. However, when I compile those files in Unix using the makefile that I wrote I got the following errors

    Code:
    $ make
    g++ -c main.cc
    g++ -c impletment.cc
    g++ -o main.o impletment.o
    Undefined                       first referenced
     symbol                             in file
    main                                /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2.3/crt1.o
    ld: fatal: Symbol referencing errors. No output written to main.o
    collect2: ld returned 1 exit status
    make: *** [student_record] Error 1
    Could someone please help me out? I don't what this error is. Is it some thing wrong with my makefile. Thank you in advance.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    42
    I missed student_record in my makefile. Thanks anyway

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. works in Borland, does not work in Unix T_T
    By dot_rain in forum C Programming
    Replies: 1
    Last Post: 03-14-2004, 10:22 AM
  2. The Bludstayne Open Works License
    By frenchfry164 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-26-2003, 11:05 AM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  4. Replies: 6
    Last Post: 01-07-2002, 02:46 AM
  5. Works on Dev C++, Doesn't on Visual C++ :(
    By marcvb in forum C++ Programming
    Replies: 6
    Last Post: 11-26-2001, 08:39 AM