Undefined reference to *

Program compiles on linux but not on windows!

Page 1 of 1

4 Replies - 902 Views - Last Post: 20 August 2009 - 04:02 PM Rate Topic: -----

#1 l0ckz0r  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 04-June 09

Undefined reference to *

Post icon  Posted 19 August 2009 - 07:05 PM

This is an assignment that I wrote on Windows using Code::Blocks IDE
Then I error checked it with Ubuntu using G++, the program then compiles fine. So keep in mind my problem is that I want to know what I have to do in WINDOWS to get this working for future projects, because i prefer using Code::blocks to Ubuntu text editors.

This is a multi file program using custom headers. My problem is somewhere in the linking.
Here is my build error.

A1main.cpp||undefined reference to `loadBk(phoneBk*)'|
A1main.cpp||undefined reference to `AddPerson(phoneBk*)'|
A1main.cpp||undefined reference to `ChangePosition(phoneBk*)'|
A1main.cpp||undefined reference to `MoveRoom(phoneBk*)'|
A1main.cpp||undefined reference to `DisplayByName(phoneBk*)'|
A1main.cpp||undefined reference to `DisplayByPhone(phoneBk*)'|
A1main.cpp||undefined reference to `LoadDB(phoneBk*)'|
A1main.cpp||undefined reference to `StoreDB(phoneBk*)'|
A1main.cpp||undefined reference to `CompleteList(phoneBk*)'|
||=== Build finished: 9 errors, 0 warnings ===|


I don't want to paste the WHOLE assignment here, so I'll share only the important stuff, ask if there is other stuff you want to see:

Here is A1main.cpp this is the driver program for the other functions; my other files are called functions.h and functions.cpp

A1main.cpp:



phoneBk is a struct and staffArray is an array of phoneBk
My header file contains all the necissary includes and function prototypes.

Any ideas?

This post has been edited by l0ckz0r: 20 August 2009 - 04:01 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Undefined reference to *

#2 oQMr FoxQo  Icon User is offline

  • D.I.C Head

Reputation: 16
  • View blog
  • Posts: 123
  • Joined: 16-August 09

Re: Undefined reference to *

Posted 19 August 2009 - 07:21 PM

look at this example it may help u
Was This Post Helpful? 0
  • +
  • -

#3 l0ckz0r  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 04-June 09

Re: Undefined reference to *

Posted 19 August 2009 - 10:20 PM

View PostoQMr FoxQo, on 19 Aug, 2009 - 06:21 PM, said:

look at this example it may help u


It's not the name, ive double and triple checked.
Was This Post Helpful? 0
  • +
  • -

#4 Mrafcho001  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 41
  • View blog
  • Posts: 769
  • Joined: 01-November 05

Re: Undefined reference to *

Posted 19 August 2009 - 10:27 PM

Have you added functions.cpp to your project? it looks like functions.cpp isn't being compiled with your project, therefore not including the definitions of the functions into the project which gives you that error.

Those errors basically mean the body of the functions are missing.

This post has been edited by Mrafcho001: 19 August 2009 - 10:27 PM

Was This Post Helpful? 0
  • +
  • -

#5 l0ckz0r  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 04-June 09

Re: Undefined reference to *

Posted 20 August 2009 - 04:02 PM

View PostMrafcho001, on 19 Aug, 2009 - 09:27 PM, said:

Have you added functions.cpp to your project? it looks like functions.cpp isn't being compiled with your project, therefore not including the definitions of the functions into the project which gives you that error.

Those errors basically mean the body of the functions are missing.


I found out the problem was my IDE

Code::blocks does specifically require you to build a project and add your files into it, it wont automatically compile all linked files.

Despite this, it's still my favourite IDE
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1