Why cannot I compile these with Dev-C++?

This is a discussion on Why cannot I compile these with Dev-C++? within the C++ Programming forums, part of the General Programming Boards category; Hello, I've two examples, directly taken by my C++ manual, with no changes made by me. You can find the ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    26

    Why cannot I compile these with Dev-C++?

    Hello,

    I've two examples, directly taken by my C++ manual, with no changes made by me.

    You can find the main program file and the header file attached.

    When I try to compile the project I have these errors:

    Code:
      [Linker error] undefined reference to `Stock::Stock(char const*, int, double)'
      [Linker error] undefined reference to `Stock::Stock(char const*, int, double)' 
      [Linker error] undefined reference to `Stock::Stock(char const*, int, double)' 
      [Linker error] undefined reference to `Stock::Stock(char const*, int, double)' 
      [Linker error] undefined reference to `Stock::~Stock()' 
      [Linker error] undefined reference to `Stock::show() const' 
      [Linker error] undefined reference to `Stock::topval(Stock const&) const' 
      [Linker error] undefined reference to `Stock::show() const' 
      [Linker error] undefined reference to `Stock::~Stock()' 
      [Linker error] undefined reference to `Stock::~Stock()' 
      [Linker error] undefined reference to `Stock::~Stock()' 
      [Linker error] undefined reference to `Stock::~Stock()' 
      ld returned 1 exit status
    Can you please help me?
    Thank you!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    You have to also include stock2.cpp in your project. Do you have that file?

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    26
    Now got it and included. It works.

    THANK YOU

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compile problem on linux
    By cnb in forum C Programming
    Replies: 3
    Last Post: 09-29-2008, 05:14 AM
  2. auto_ptr assignment compile error
    By George2 in forum C++ Programming
    Replies: 7
    Last Post: 04-01-2008, 03:44 AM
  3. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  4. Dev C++ Won't Compile
    By mburt in forum Windows Programming
    Replies: 8
    Last Post: 08-22-2006, 12:14 AM
  5. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM

Tags for this Thread


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