none
error:无法打开源文件"stdafx.h" RRS feed

  • 问题

  •   我在编程的时候,用的是vs2010,感觉它的新功能很强大。在源文件开始的那个#include下都有一条红色波浪线 ,提示error:无法打开源文件"stdafx.h",但是编译成功后还是能执行,这是怎么回事呢,能不能把这个提示消除呢。

    截图:[url=http://tu.6.cn/pic/show-new/id/8625405][img]http://i3.6.cn/cvbnm/7d/2c/01/348fd5cfebd4b190d94a940c79d88e64.jpg[/img][/url]

    • 已编辑 刘天逸 2010年6月15日 3:19 遗漏
    2010年6月15日 3:17

答案

  • 你可能需要设置一下你的工程属性,把C/C++中的Precompiled Header中的Create/Use Precompiled Header 设置为Not Using Precompiled Headers
    0xBAADF00D
    2010年6月17日 2:15
    版主
  • 似乎应该小写s。你截图里S大写了。我不知道是不是这个原因。你可以试试。
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    2010年6月22日 9:46
  • 似乎应该小写s。你截图里S大写了。我不知道是不是这个原因。你可以试试。
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!


    引用头文件好像大小写没有关系吧.

    试试带路径的#include


    懂就是懂,不懂就是不懂.说了你也不会懂滴.....这就是差距....
    2010年6月25日 1:12
  • 看一下工程include属性是否正确
    2010年6月28日 6:42
  • 是不是未将StdAfx.h添加到解决方案中?如果未添加:打开“解决方案资源管理器”(在菜单栏的“视图”菜单中);右键单击“头文件”筛选器;添加->现有项;选择你的解决方案文件夹中的“StdAfx.h”文件;单击“添加”按钮。
    2011年7月31日 8:52

全部回复

  • 你可能需要设置一下你的工程属性,把C/C++中的Precompiled Header中的Create/Use Precompiled Header 设置为Not Using Precompiled Headers
    0xBAADF00D
    2010年6月17日 2:15
    版主
  • 似乎应该小写s。你截图里S大写了。我不知道是不是这个原因。你可以试试。
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    2010年6月22日 9:46
  • 似乎应该小写s。你截图里S大写了。我不知道是不是这个原因。你可以试试。
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!


    引用头文件好像大小写没有关系吧.

    试试带路径的#include


    懂就是懂,不懂就是不懂.说了你也不会懂滴.....这就是差距....
    2010年6月25日 1:12
  • 看一下工程include属性是否正确
    2010年6月28日 6:42
  • 是不是未将StdAfx.h添加到解决方案中?如果未添加:打开“解决方案资源管理器”(在菜单栏的“视图”菜单中);右键单击“头文件”筛选器;添加->现有项;选择你的解决方案文件夹中的“StdAfx.h”文件;单击“添加”按钮。
    2011年7月31日 8:52
  • 显示波浪线并报错应该是路径问题

    编译能通过,是因为VS已经自动把stdafx.h这个文件添加到项目里了

    • 已建议为答案 KingMario 2013年1月23日 6:37
    2013年1月23日 6:37