Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: C++ Header problem  (Read 2769 times)

0 Members and 1 Guest are viewing this topic.

Patplays852

    Topic Starter


    Rookie
    C++ Header problem
    « 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?
    « Last Edit: May 02, 2009, 11:45:10 AM by Patplays852 »