Computer Hope

Software => Computer programming => Topic started by: Patplays852 on May 02, 2009, 10:35:07 AM

Title: C++ Header problem
Post by: Patplays852 on May 02, 2009, 10:35:07 AM
I am trying to create an "all inclusive" header so i only need to type #include "all.h" at the beginning of a program

As I am still learning, i only have three things in all.h atm which include:

Code: [Select]
ifndef ALL_H 
define ALL_H 

#include <iostream>
#include "stdafx.h"
#include <cstdlib>

endif

and in my main project i have:

Code: [Select]
#include "all.h"

int main()
{
//code
}


but when i try to compile the program i get this error:
Code: [Select]
d:\c++ projects\helloworld\helloworld\helloworld.cpp(1) : warning C4627: '#include "all.h"': skipped when looking for precompiled header use
        Add directive to 'stdafx.h' or rebuild precompiled header
d:\c++ projects\helloworld\helloworld\helloworld.cpp(12) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

it is a short file... and line 12 would be directly after the } ending the main() but nothing is there.

So, I am asking if I have my header setup right, and is it even possible to do what I am trying to do?