trying to use '#include ' in VS 2010

前端 未结 3 921
遥遥无期
遥遥无期 2020-12-05 23:50

I\'m trying to use the stdbool.h library file in a C program. When I try to compile, however, an error message appears saying intellisense cannot open source file stdbool.h.

3条回答
  •  不思量自难忘°
    2020-12-06 00:10

    Create your own file to replace stdbool.h that looks like this:

    #pragma once
    
    #define false   0
    #define true    1
    
    #define bool int
    

    In Visual Studio 2010 I had an issue using typedef int bool; as suggested elsewhere. IntelliSense complained about an "invalid combination of type specifiers." It seems that the name "bool" is still special, even though it's not defined.

提交回复
热议问题