Thread: problem including .h file thats in its own folder

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    319

    problem including .h file thats in its own folder

    #include "ClassWindowOne\ClassWindowOne.h"

    this is in main but compiler says it cant find ClassWindowOne.h
    WinMain cpp is on D:\ then i made a folder on there called ClassWindowOne
    then added the files to the workspace , but i cant seem to compile..

    Code:
    //class 1 inside ClassWindowOne folder
    class Window1
    {
    public:
    void CreateWin();
    };
    Code:
    #include "ClassWindowOne.h"
    #include <windows.h>
    
    void Window1::CreateWin()
    {
    	MessageBox(NULL,"test","test",0);
    }
    Code:
    //main
    #include "ClassWindowOne\ClassWindowOne.h"
    
    int main()
    {
    	Window1 W1;
    	W1.CreateWin();
    	return 0;
    }
    Last edited by Anddos; 03-25-2007 at 02:22 PM.

  2. #2

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>added the files to the workspace<<

    Just use #include "ClassWindowOne.h" in all source files that require it.

    Any decent IDE should handle the path(s), otherwise you'll need to specify the full path(s) explicitly or add them to your project/workspace's options.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. Problem with include file.
    By Roaring_Tiger in forum C Programming
    Replies: 1
    Last Post: 02-26-2003, 01:48 AM