User forums > General (but related to Code::Blocks)
Sleep() function errors
Vlad417:
C:/Program Files/CodeBlocks/include/winbase.h:607: error: `DWORD' does not name a type
C:/Program Files/CodeBlocks/include/winbase.h:608: error: `DWORD' does not name a type
C:/Program Files/CodeBlocks/include/winbase.h:609: error: `DWORD' does not name a type
C:/Program Files/CodeBlocks/include/winbase.h:610: error: `DWORD' does not name a type
Process terminated with status 1 (0 minutes, 2 seconds)
52 errors, 1 warnings
Some specs
Compiler: GNU GCC
Windows XP SP2
AMD Athlon64 3500+
stahta01:
This works for me under minGW GCC, but I could not get Sleep() or sleep() to work OK, I am guessing that I am missing an needed header.
Tim S
--- Code: ---#include <iostream>
using namespace std;
int main()
{
cout << "Going to Sleep!" << endl;
_sleep(10000); // time in milliseconds
cout << "Hello world!" << endl;
return 0;
}
--- End code ---
TDragon:
--- Quote from: stahta01 on June 05, 2007, 11:34:22 pm ---... I am guessing that I am missing an needed header.
--- End quote ---
That would be windows.h.
DaVince:
Include windows.h.
EDIT: just too late. I wish I weren't a C++ newbie and had to look at how I solved the problem again. >_<
stahta01:
--- Quote from: TDragon on June 05, 2007, 11:37:28 pm ---
--- Quote from: stahta01 on June 05, 2007, 11:34:22 pm ---... I am guessing that I am missing an needed header.
--- End quote ---
That would be windows.h.
--- End quote ---
That was not enough, for sleep() to work. But, it was enough to get Sleep() to work.
Note, Google said minGW runtime had issues on sleep()
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version