1.

Solve : C++ Header problem?

Answer»

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?



Discussion

No Comment Found