【发布时间】:2014-04-16 05:07:01
【问题描述】:
这是我在 Visual Studio 2010 中的代码的一部分。但是我从编译器中得到了“IntelliSense:标识符“GetTickCount”未定义”。我不知道如何解决它。
typedef enum {FALSE = 0, TRUE} BOOL;
int main(int argc, char* argv[]){
double current_Time;
current_Time = GetTickCount()/1000.0 - start/1000;
....
这些是我在代码中包含的内容
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <conio.h>
【问题讨论】:
-
msdn.microsoft.com/en-us/library/windows/desktop/… 说“包括 windows.h”
-
当我包含 "#include "windows.h" 时,我不再能够正确使用
typedef enum {FALSE = 0, TRUE} BOOL;,它的行为就像它无法识别表达式并加下划线一样。我需要我的布尔值代码。 -
符号
FALSE和TRUE可能已经定义为0和1,这意味着你的enum被扩展为enum {0 = 0, 1} BOOL;,这会有问题。跨度> -
Windows 已经定义了
BOOL、TRUE和FALSE。看看this article from MSDN。 -
你能做一些不同的事情吗?例如:typedef enum{MY_FALSE, MY_TRUE} BOOLEAN;
标签: c visual-studio-2010 gettickcount