LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-08-2005, 07:09 PM   #1
glevine
LQ Newbie
 
Registered: May 2004
Posts: 10

Rep: Reputation: 0
make produces errors


I am trying to write a program that simulates 6 different page replacement algorithms. The program is written in C++ on a Windows XP machine under Visual Studio .NET 2003. I am trying to port the program over to linux, but I am running into a problem. At this moment I am only trying to only compile main and my class that runs the fifo algorithm. I have another class which reprseents the page references as they come in. In my makefile I compile all of these files and try to create an executable. If I type make in the terminal then I get the following errors:

g++ -c PageReference.cpp
g++ -c FIFOPageReplacement.cpp
g++ -c main.cpp
g++ -o pagerefsim main.o
main.o(.text+0x99): In function `main':
: undefined reference to `FIFOPageReplacement::FIFOPageReplacement[in-charge](int)'
main.o(.text+0x140): In function `main':
: undefined reference to `PageReference::PageReference[in-charge](int, char)'
main.o(.text+0x1a3): In function `main':
: undefined reference to `FIFOPageReplacement::add(PageReference*)'
main.o(.text+0x1ba): In function `main':
: undefined reference to `FIFOPageReplacement::run()'
main.o(.text+0x1d3): In function `main':
: undefined reference to `FIFOPageReplacement:rint(std::basic_ofstream<char, std::char_traits<char> >&)'
collect2: ld returned 1 exit status
make: *** [pagerefsim] Error 1

Does anyone have any idea how to fix this problem?

Thanks.
 
Old 05-08-2005, 07:33 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
You "fix it" by including all your object files when trying to create the executable

For instance:
Code:
g++ -o pagerefsim main.o PageReference.o FIFOPageReplacement.o
The linker is complaining because it cannot find the implementation of the FIFOPageReplacement constructor and other member functions. Your main.o does not automatically include that information; it's all in your other .o files. If those files aren't "ready for primetime" because you're still porting them, then you'll have to wait until they're finished, or temporarily comment out any references to them in main.c until they are ready.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mpage produces errors when viewing in gsview sohmc Linux - Software 0 08-27-2005 05:27 AM
Make errors lazwaz Linux - Software 1 05-21-2005 04:37 AM
Chap 5 Binutils make LDFLAGS & make install errors shotokan Linux From Scratch 5 04-10-2005 03:01 AM
'make' errors... drenal Linux - Newbie 3 04-21-2004 07:51 PM
make command for driver produces error and blames stdio.h! Veivann Linux - Newbie 5 03-11-2004 05:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration