我的程序用了一个tree control和一个MS COMMUNICATION CONTROL
vc显示的错误为:
--------------------Configuration: comm - Win32 Release--------------------
Build : warning : failed to (or don't know how to) build 'D:\christin_download\Prj_test\comm\Release\comm.pch'
Compiling...
comm.cpp
D:\christin_download\Prj_test\comm\comm.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Release/comm.pch': No such file or directory
commDlg.cpp
D:\christin_download\Prj_test\comm\commDlg.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Release/comm.pch': No such file or directory
mscomm.cpp
D:\christin_download\Prj_test\comm\mscomm.cpp(7) : fatal error C1083: Cannot open precompiled header file: 'Release/comm.pch': No such file or directory
Generating Code...
Error executing cl.exe.comm.exe - 3 error(s), 1 warning(s)

解决方案 »

  1.   

    Debug和Release的setting,应该相同,
    多试rebuild all
      

  2.   

    release设置中使用了与编译头文件。去掉
      

  3.   

    project->setting->release->c/c++->precompiled headers
    maybe u should change it to "stdafx.h" from "comm.h"
      

  4.   

    我在project->setting->release->c/c++->下找不到precompiled headers,我对vc不是很熟,是在project->setting->release->c/c++->下的Project Option里设置吗?我的设置是这样的:
    /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D 
    "_WINDOWS" /D "_MBCS" /Fp"Release/comm.pch" 
    /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
    不知是否有问题呢?谢谢!!
      

  5.   

    /Fp"Release/comm.pch" -> /Fp"Release/stdafx.pch"试试
      

  6.   

    /Fp"Release/comm.pch" -> /Fp"Release/stdafx.pch"
    在release模式下这样改了以后,我的程序build的时候错误提示变了一点点:
    --------------------Configuration: comm - Win32 Release--------------------
    Compiling...
    comm.cpp
    D:\christin_download\Prj_test\comm\comm.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Release/stdafx.pch': No such file or directory
    commDlg.cpp
    D:\christin_download\Prj_test\comm\commDlg.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Release/stdafx.pch': No such file or directory
    mscomm.cpp
    D:\christin_download\Prj_test\comm\mscomm.cpp(7) : fatal error C1083: Cannot open precompiled header file: 'Release/stdafx.pch': No such file or directory
    Generating Code...
    Error executing cl.exe.comm.exe - 3 error(s), 0 warning(s)我在debug模式下把/Fp"Release/comm.pch" -> /Fp"Release/stdafx.pch"后build也顺利通过。不知道为什么?谢谢你!!
      

  7.   

    compile stdafx.cpp to generate stdafx.pch
      

  8.   

    还是不行:
    在release模式下,在右击stdafx.cpp弹出的菜单中,Compile选项是grayed,不可用。
    其他的.cpp文件倒是可以compile.
    而在debug模式下,所有的文件都可以compile.真的很感谢你不厌其烦的指教!!