Welcome To Heike07's Blog.

欢迎来到Heike07官方博客

[c/c++] 解决:...nclude file: 'stdbool.h': No such file or directory...

最近有用户在编写代码的时候出现了
                   fatal error C1083: Cannot open include file: ‘stdbool.h’: No such file or directory
这个问题,这里我解决一下~

声明:资料来源与互联网拼凑而成!并非本人原创~,重在整理~《 解决:...nclude file: 'stdbool.h': No such file or directory...》

首先确定是否有头文件,检查方法:
用cfree-5.0 在头文件上按f12即可,如有直接跳到头文件~
vc去目录里找~

include files:
…\Microsoft Visual Studio\VC98\INCLUDE
…\Microsoft Visual Studio\VC98\MFC\INCLUDE
…\Microsoft Visual Studio\VC98\ATL\INCLUDE

如果没有添加即可~以下是头文件,在cf的include里copy的~

  1. /* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with GCC; see the file COPYING.  If not, write to
  13. the Free Software Foundation, 59 Temple Place – Suite 330,
  14. Boston, MA 02111-1307, USA.  */
  15. /* As a special exception, if you include this header file into source
  16.    files compiled by GCC, this header file does not by itself cause
  17.    the resulting executable to be covered by the GNU General Public
  18.    License.  This exception does not however invalidate any other
  19.    reasons why the executable file might be covered by the GNU General
  20.    Public License.  */
  21. /*
  22. * ISO C Standard:  7.16  Boolean type and values  <stdbool.h>
  23. */
  24. #ifndef _STDBOOL_H
  25. #define _STDBOOL_H
  26. #ifndef __cplusplus
  27. #define bool        _Bool
  28. #define true        1
  29. #define false        0
  30. #else /* __cplusplus */
  31. /* Supporting <stdbool.h> in C++ is a GCC extension.  */
  32. #define _Bool        bool
  33. #define bool        bool
  34. #define false        false
  35. #define true        true
  36. #endif /* __cplusplus */
  37. /* Signal that all the definitions are present.  */
  38. #define __bool_true_false_are_defined        1
  39. #endif        /* stdbool.h */

复制代码

   添加后即可,如出现cl.exe丢失看下面的文章(来源互联网)
———————————————————————————————————————————————————————————————————————
Compiling… ,Error spawning cl.exe是vc6.0编译时,会遇到的一个问题。导致这个的问题有很多,
其中一种就是路径设置的问题引。“CL.exe”是VC使用真正的编译器(编译程序),其路径在“VC根
目录\VC98\Bin”下面, 你可以到相应的路径下找到这个应用程序。
解决方法:
打开vc界面 点击VC“TOOLS(工具)”—>“Option(选择)”—>“Directories(目录)”重新设置
“Excutable Fils、Include Files、Library Files、Source Files”的路径。很多情况可能就一个盘符的不同
(例如你的VC装在C,但是这些路径全部在D),改过来就OK了(注意:
要将目录设为你所使用的那个vc文件夹的目录,防止设错目录)。
如果你是按照初始路径安装vc6.0的,路径应为:
executatble files:
…\Microsoft Visual Studio\Common\MSDev98\Bin
…\Microsoft Visual Studio\VC98\BIN
…\Microsoft Visual Studio\Common\TOOLS
…\Microsoft Visual Studio\Common\TOOLS\WINNT

include files:
…\Microsoft Visual Studio\VC98\INCLUDE
…\Microsoft Visual Studio\VC98\MFC\INCLUDE
…\Microsoft Visual Studio\VC98\ATL\INCLUDE

library files:
…\Microsoft Visual Studio\VC98\LIB
…\Microsoft Visual Studio\VC98\MFC\LIB

source files:
…\Microsoft Visual Studio\VC98\MFC\SRC
…\Microsoft Visual Studio\VC98\MFC\INCLUDE
…\Microsoft Visual Studio\VC98\ATL\INCLUDE
…\Microsoft Visual Studio\VC98\CRT\SRC

———————————————————————————————————————————————————————————————————————

希望大家编程愉快~heike-07
点赞