help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newby Question


From: Casper3912
Subject: Newby Question
Date: Tue, 12 Apr 2011 17:28:30 -0700 (PDT)

I'm brand new to make files, and I was hoping someone could tell me where I'm
messing up. 
I'm trying to build a cpp program I wrote for class on a linux system, i'm
using winscp and puTTy. 
The program works fine when I build it using the visual studios 2008 IDE, so
the problem should be in my makefile I believe. My makefile and all files
needed for the project are in the same directory. I would greatly appreciate
any help, hopefully its a easy fix. Thanks in advance.

Here is my make file: 
# Make File For AHeapOfStudents Project

CC = g++
CFLAGS = -g 
CMD = AHeapOfStudents_exec

OBJS = Main.o Student.o Address.o Date.o Name.o Proformance.o 
CCFILES = Main.cc Student.cc Address.cc Date.cc Name.cc Proformance.cc
HFILES = Student.h Address.h Date.h Name.h Proformance.h

$(CMD): $(OBJS)
        $(CC)  -o $(CMD) $(OBJS)

Main.o: Main.cc Student.h
        $(CC) $(CFLAGS) -c Main.cc

Student.o:      Student.cc Address.h Date.h Name.h Performance.h
        $(CC) $(CFLAGS) -c Student.cc

Address.o:      Address.cc Address.h
        $(CC) $(CFLAGS) -c Address.cc

Date.o: Date.cc Date.h
        $(CC) $(CFLAGS) -c Date.cc
        
Name.o: Name.cc Name.h
        $(CC) $(CFLAGS) -c Name.cc
        
Performance.o:  Performance.cc Performance.h
        $(CC) $(CFLAGS) -c Performance.cc



And here is the response when I attempt to build:


make Main
g++     Main.cpp   -o Main
In file included from Student.h:3,
                 from Main.cpp:14:
Address.h:30:7: warning: no newline at end of file
In file included from Main.cpp:14:
Student.h:37:7: warning: no newline at end of file
/tmp/ccyPQFpG.o: In function `Alphabetize(Student*)':
Main.cpp:(.text+0x1f34): undefined reference to `Student::GetSName()'
Main.cpp:(.text+0x1f49): undefined reference to `Name::GetLastName()'
Main.cpp:(.text+0x1fbc): undefined reference to `Student::GetSName()'
Main.cpp:(.text+0x1fd1): undefined reference to `Name::GetLastName()'
Main.cpp:(.text+0x2041): undefined reference to `Student::GetSName()'
Main.cpp:(.text+0x2056): undefined reference to `Name::GetFirstName()'
Main.cpp:(.text+0x20c9): undefined reference to `Student::GetSName()'
Main.cpp:(.text+0x20de): undefined reference to `Name::GetFirstName()'
/tmp/ccyPQFpG.o: In function `SimplePrint(Student*, int)':
Main.cpp:(.text+0x23c1): undefined reference to `Student::SimpleReport()'
/tmp/ccyPQFpG.o: In function `Print(Student*, int)':
Main.cpp:(.text+0x246b): undefined reference to `Student::Report()'
/tmp/ccyPQFpG.o: In function `main':
Main.cpp:(.text+0x2714): undefined reference to
`Name::SetFirstName(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x2787): undefined reference to
`Name::SetLastName(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x27dd): undefined reference to `Student::SetSName(Name)'
Main.cpp:(.text+0x284d): undefined reference to
`Address::SetLine1(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x28bd): undefined reference to
`Address::SetLine2(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x292d): undefined reference to
`Address::SetCity(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x299d): undefined reference to
`Address::SetState(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
Main.cpp:(.text+0x2a0b): undefined reference to `Address::SetZip(int)'
Main.cpp:(.text+0x2a2f): undefined reference to
`Student::SetSAddress(Address)'
Main.cpp:(.text+0x2a98): undefined reference to `Date::SetDay(int)'
Main.cpp:(.text+0x2ada): undefined reference to `Date::SetMonth(int)'
Main.cpp:(.text+0x2b1c): undefined reference to `Date::SetYear(int)'
Main.cpp:(.text+0x2b3f): undefined reference to
`Student::SetSBirthDate(Date)'
Main.cpp:(.text+0x2b79): undefined reference to `Date::SetDay(int)'
Main.cpp:(.text+0x2bbb): undefined reference to `Date::SetMonth(int)'
Main.cpp:(.text+0x2bfd): undefined reference to `Date::SetYear(int)'
Main.cpp:(.text+0x2c20): undefined reference to
`Student::SetSGradDate(Date)'
Main.cpp:(.text+0x2c6e): undefined reference to `Performance::SetGPA(float)'
Main.cpp:(.text+0x2cb0): undefined reference to
`Performance::SetCredits(int)'
Main.cpp:(.text+0x2ccf): undefined reference to
`Student::SetSPerformance(Performance)'
collect2: ld returned 1 exit status
make: *** [Main] Error 1
address@hidden HeapOfStudents]$


-- 
View this message in context: 
http://old.nabble.com/Newby-Question-tp31383887p31383887.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]