Thread: including an .h file

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    17

    including an .h file

    I have looked through some of the posts and understand how to include a .h file. I have my .cpp and .h file saved in the same place but when I compile I get the error that my .h file doesn't exsist??!! Any suggestions as to why this might be happening??

    Code:
    #include <string>
    #include<iostream>
    #include "avlbst.h"
    
    using namespace std;
    int item;
    
    int main (){
    
    	cout<< "Enter the item that you would like to place in the Binary Search Tree"<< endl;
    
    		cin >> item;
    
    		while (cin ){
    			AVLBST.AVLInsert(item);
    			AVLBST.PrettyPrint();
    		}
    
    		return 0;
    }

  2. #2
    tetra
    Guest

    link?

    i dont know what compiler yuou are using, but it is nessicary in msvc++ to link the file. to do this you do the following


    * have both windows open( your .cpp and your .h )

    * then go to project<<add to project<< then files, and you should see your header file there ... include it.

    * to make sure they are together, click in th workspace bar below it says file view click on that and double click the project name it should drop down for ya

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    17
    I am using msvc++ and I didn't link the two. Thanks very much!!!

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    51
    no problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM