Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or directo
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or directo

  1. #1
    Join Date
    Mar 2005
    Posts
    20

    Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or directo

    I use the Visual C++ 2005 Express beta2.
    and here is a simple program i have writed:
    Code:
    #include "stdafx.h"
    #include <iostream>
    uing namespace std;
    using namespace System;
    
    int main(array<System::String ^> ^args)
    {
        cout<<"success!";
    	Console::WriteLine(L"Hello World");
        return 0;
    }
    //-----------------------------------------------------------------
    but it alaways tell me the error information
    fatal error C1083: Cannot open precompiled header file: 'Debug\test4.pch': No such file or directory

    that's why?who know that.

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Build stdafx.cpp first
    Succinct is verbose for terse

  3. #3
    Join Date
    Oct 1999
    Location
    ks
    Posts
    502

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or directo

    right click on the file name in the explorer (under source files)
    select properties
    select precompiled headers
    select "not using precompiled headers"

  4. #4
    Join Date
    Feb 2004
    Location
    Texas, USA
    Posts
    1,206

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Go to your project folder and delete your debug folder. This erases your old Precompiled Header file. If you made changes to any precompiled headers and then compiled them, it will give this error if you are "Using Precompiled Headers".
    --MrDoomMaster
    --C++ Game Programmer


    Don't forget to rate me if I was helpful!

  5. #5
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or directo

    I always disable precompiled headers when using Visual C++. I want portable code, and it compiles fast enough for me anyway.

  6. #6
    Join Date
    May 2009
    Posts
    1

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Try to Change #include <iostream> to #include "iostream.h"

  7. #7
    Join Date
    Aug 2007
    Posts
    858

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Quote Originally Posted by erikax View Post
    Try to Change #include <iostream> to #include "iostream.h"
    No. iostream.h is an out of date header; iostream (no .h) is correct.

  8. #8
    Join Date
    Apr 1999
    Posts
    27,434

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Quote Originally Posted by erikax View Post
    Try to Change #include <iostream> to #include "iostream.h"
    How is that going to solve the problem?

    Anyway, there is no such header file as "iostream.h" in Visual C++ 2003 and above.

    Regards,

    Paul McKenzie

  9. #9
    Join Date
    Apr 1999
    Posts
    27,434

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Quote Originally Posted by mloonjin View Post
    I use the Visual C++ 2005 Express beta2.
    and here is a simple program i have writed:
    Code:
    int main(array<System::String ^> ^args)
    Wrong forum. That is not C++. That is some other language called "Managed C++", which is not the same as C++.

    Regards,

    Paul McKenzie

  10. #10
    Join Date
    May 2011
    Posts
    1

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Make sure that stdafx.cpp is set to /Yc. Right-click, properties, C/C++, Precompiled Headers, Precompiled Header = Create (/Yc)

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,127

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir

    Quote Originally Posted by exsuscito View Post
    Make sure that stdafx.cpp is set to /Yc. Right-click, properties, C/C++, Precompiled Headers, Precompiled Header = Create (/Yc)
    Can somebody please explain to me why people bump really old threads for their first post. This one is six years old. I really don't get it.

  12. #12
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: Can't Cannot open precompiled header file: 'Debug\test4.pch': No such file or dir


Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center