CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Why ????

  1. #1
    Join Date
    Aug 1999
    Posts
    17

    Why ????

    I wrote 2 files, "Extra.h" and "Extra.cpp"
    Why the compiler said:
    c:\my documents\receipt\extra.cpp(21) : fatal error C1010: unexpected end of file while looking for precompiled header directive
    here is the code of extra.cpp

    // implementation of extra functions
    /////////////////////////////////////

    // change to real date value
    void ToReal(int &nDay,int &nMonth,int &nYear)
    {
    nDay=nDay+1;
    nMonth=nMonth+1;
    nYear=nYear+1999;
    }

    // change to combo box value
    void ToFake(int &nDay,int &nMonth,int &nYear)
    {
    nDay=nDay-1;
    nMonth=nMonth-1;
    nYear=nYear-1999;
    }



    Here is the header file Extra.h

    // this file to contain prototype for extra functions
    ///////////////////////////////////////////////////

    // change value of m_nDay, m_nMonth and m_nYear back and forth

    //change to real value of date
    void ToReal(int &nDay,int &nMonth,int &nYear);

    // change to combo box value
    void ToFake(int &nDay,int &nMonth, int &nYear);



    Thanks



  2. #2
    Join Date
    May 1999
    Location
    Texas, USA
    Posts
    568

    Re: Why ????

    In the header file put the word "extern" in front of the declarations and let me know if that works.


  3. #3
    Join Date
    Apr 1999
    Location
    Beaverton, OR
    Posts
    241

    Re: Why ????

    In the .cpp file, before including Extra.h, you need to include stdafx.h.
    #include "stdafx.h"
    #include "Extra.h"




  4. #4
    Join Date
    May 1999
    Location
    Texas, USA
    Posts
    568

    Re: Why ????

    nordyj is right, I just assumed you did that.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured