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

This is a discussion on unix makefile won't work but works in Dev C++ within the C++ Programming forums, part of the General Programming Boards category; I have three file impletment.cc , main.cc and student.h. Here is my makefile Code: CC = g++ student_record: main.o impletment.o ...

  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, 09: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, 10:05 AM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  4. Replies: 6
    Last Post: 01-07-2002, 01: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, 07:39 AM

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