Hey :)

I have written this code, but it seems that theres an error in it, that i can't find. When i try to compile it i get this error: Call to undefined function 'sleep' in function main().

I know it has something to do with that sleep function, because when i remove it, it works.
Someone help me plz :)

#include <iostream.h>
#include <windows.h>

int test;

int main(void)
cin >> test;

if(test == 123)
	cout << "Venter nu 5 sekunder!";
	cout << "Der er nu gaaet 5 sekunder!";
	cout << "Her er noget galt :P" << endl;
Excizted commented: Good post +1

Recommended Answers

All 4 Replies

"Call to undefined function..." means that a function's name as written does not exist.

C++ is case sensitive. Have you double-checked your capitalization? Look up the sleep function in your help file for the Windows library.

Hi there :)

I happen to know that the sleep function has a capitalized S.
So you should call Sleep() instead of sleep().

The previous poster already told you what the compilation error means, remember that :)

Also Sleep is defined in the windows libraries, which you did include, so you should be good to go, if you just capitalize your S.

#include <windows.h>

Have fun :)

Okay, this actualy made me laugh :D
It worked with making capitalized S never knew that :P
Thx to you guys :D

Hehe, you're welcome :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.