【问题标题】:Having trouble get GetTickCount() in C在 C 中获取 GetTickCount() 时遇到问题
【发布时间】: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>

【问题讨论】:

  • 当我包含 "#include "windows.h" 时,我不再能够正确使用typedef enum {FALSE = 0, TRUE} BOOL;,它的行为就像它无法识别表达式并加下划线一样。我需要我的布尔值代码。
  • 符号FALSETRUE可能已经定义为01,这意味着你的enum被扩展为enum {0 = 0, 1} BOOL;,这会有问题。跨度>
  • Windows 已经定义了BOOLTRUEFALSE。看看this article from MSDN
  • 你能做一些不同的事情吗?例如:typedef enum{MY_FALSE, MY_TRUE} BOOLEAN;

标签: c visual-studio-2010 gettickcount


【解决方案1】:

在头文件中包含 widows.h 文件..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-21
    • 1970-01-01
    • 2012-09-28
    • 2017-07-21
    • 2013-08-06
    • 2021-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多