Can't compile - Error C1010 - Precompiled header? 
Author Message
 Can't compile - Error C1010 - Precompiled header?

It's bad enough that it took me 4 hours to install this
Beta (install program kept{*filter*} & suspending activity).

But the fact that the C++ compiler can't compile a simple
example program from a C++ book (which VC++ 6 had no
problem with) is really pathetic).

Any help with the following would be appreciated.

Scott
-----

When attempting to compile the program below, which
demonstrates function overloading, the following error is
reported:
---------------
c:\Documents and Settings\Administrator\My Documents\Visual
Studio Projects\overld\overld.cpp(55) : fatal error C1010:
unexpected end of file while looking for precompiled header
directive
---------------

Here's the source code:
-----------------------
#include <iostream>
using namespace std;

int max(int array[], int len);
long max(long array[], int len);
double max(double array[], int len);

int main(void)
{
        int small[] = {1,24,34,22};
        long medium[] = {23,245,123,1,234,2345};
        double large[] = {23.0,1.4,2.456,345.5,12.0,21.0};

        int lensmall = sizeof small / sizeof small[0];
        int lenmedium = sizeof medium / sizeof medium[0];
        int lenlarge = sizeof large / sizeof large[0];

        cout << endl << max(small, lensmall);
        cout << endl << max(medium, lenmedium);
        cout << endl << max(large, lenlarge);

        count << endl;
        return 0;

Quote:
}

// Maximum of ints
int max(int x[], int len)
{
        int max = x[0];
        for(int i = 1; i < len; i++)
                if (max < x[i])
                        max = x[i];
        return max;

Quote:
}

// Maximum of longs
int max(long x[], int len)
{
        long max = x[0];
        for(int i = 1; i < len; i++)
                if (max < x[i])
                        max = x[i];
        return max;

Quote:
}

// Maximum of doubles
double max(double x[], int len)
{
        double max = x[0];
        for(int i = 1; i < len; i++)
                if (max < x[i])
                        max = x[i];
        return max;
Quote:
}



Sun, 14 Mar 2004 02:07:27 GMT  
 Can't compile - Error C1010 - Precompiled header?
Scott,

Quote:
> It's bad enough that it took me 4 hours to install this
> Beta (install program kept{*filter*} & suspending activity).

> But the fact that the C++ compiler can't compile a simple
> example program from a C++ book (which VC++ 6 had no
> problem with) is really pathetic).

Actually, the error is mostly on your end, sorry. You seem to have created a
project with precompiled header support, and so, the compiler expects the
directive to be there. Easiest way to fix it would be to add
#include "stdafx.h"
right at the top (and I do mean top, before anything else) of your cpp file,
or else disable precompiled header support from the project settings.

--
Tomas Restrepo



Sun, 14 Mar 2004 02:38:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. fatal error C1010: unexpected end of file while looking for precompiled header directive

2. fatal error C1010: unexpected end of file while looking for precompiled header directive

3. fatal error C1010: unexpected end of file while looking for precompiled header d

4. Why get fatal error C1010: unexpected end of file while looking for precompiled header directive

5. Help Please! Error C1010: precompiled header directives

6. Help Please! Error C1010: precompiled header directives

7. fatal error C1010: unexpected end of file while looking for precompiled header d

8. Why Get fatal error C1010: unexpected end of file while looking for precompiled header directive

9. Linking (DEBUG info) a static library compiled with precompiled headers

10. Linking (DEBUG info) a static library compiled with precompiled headers

11. Linking (DEBUG info) a static library compiled with precompiled headers

12. VC++ 4.0 compiling error C1010

 

 
Powered by phpBB® Forum Software