Thread: Im having linking problems with turbo c++ ver 4.5

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    118

    Im having linking problems with turbo c++ ver 4.5

    Background:
    I am a newbie to programming.
    I just started using this compiler, I used to use visual c++ .NET and I never had any linking problems there.

    Problem:
    I tried out with a simple program about a buffer and I got thease errors:
    Code:
    Linker Warning: No module definition file specified: using defaults
    Linker Error: Undefined symbol Buffer::~Buffer() in Module Main.cpp
    Linker Error: Undefined symbol Buffer::DisplayBuff() in Module Main.cpp
    Linker Error: Undefined symbol  Buffer::ClearBuff() in Module Main.cpp
    Linker Error: Undefined symbol Buffer::Buffer() in Module Main.cpp
    Now here is the program:

    Main.cpp
    Code:
    #include "Buffer.h"
    
    int main()
    {
    	Buffer a;
    
    	a.ClearBuff();
    	a.DisplayBuff();
    
    	return 0;
    }
    Buffer.h
    Code:
    #ifndef BUFFER_H
    #define BUFFER_H
    
    //class Buffer
    class Buffer {
    public:
    	Buffer();
    	~Buffer();
    
    	void Add(int Pos, char *b);
    	void ClearBuff();
    	void DisplayBuff();
    
    private:
    	char *a;
    };
    
    #endif
    Buffer.cpp
    Code:
    #include <iostream.h>
    #include <string.h>
    #include "Buffer.h"
    
    Buffer::Buffer()
    {
    	a = new char[1999];
    }
    
    Buffer::~Buffer()
    {
    	delete[] a;
    }
    
    void Buffer::Add(int Pos, char *b)
    {
    	int i = 0;
    
    	for (i = 0; i < strlen(b); i++)
    	{
    		if (Pos+i > 1999 || Pos+i < 0)
    			return;
    		a[Pos+i] = b[i];
    	}
    }
    
    void Buffer::ClearBuff()
    {
    	int i = 0;
    
    	for (i = 0; i < 1999; i++)
    		a[i] == ' ';
    }
    
    void Buffer::DisplayBuff()
    {
    	int i = 0;
    
    	for (i = 0; i < 1999; i++)
    		cout << a[i];
    }
    Sorry for bothering you guys but I really would like to fix this problem. Thanks for any help.
    Last edited by Marcos; 05-17-2004 at 03:04 PM.
    Why drink and drive when you can smoke and fly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linking problems
    By chris285 in forum C++ Programming
    Replies: 6
    Last Post: 01-09-2005, 01:39 AM
  2. Linking problems
    By MMD_Lynx in forum C++ Programming
    Replies: 12
    Last Post: 08-10-2004, 10:32 AM
  3. Linking Problems
    By Mini_Maggit in forum C++ Programming
    Replies: 3
    Last Post: 03-11-2004, 11:06 PM
  4. Linking problems
    By jamjar in forum C++ Programming
    Replies: 10
    Last Post: 03-28-2003, 03:07 AM
  5. Borland Turbo C/C++ V3.0 Problems
    By Mezzair in forum C Programming
    Replies: 1
    Last Post: 11-06-2002, 06:10 PM