Compiling Error!

Can someone help me with this code? When i try to compile it (in Code::Blocks)
I get the error:

expected initializer before 'void'?

If there is anything else wrong with my code please feel free to correct me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Header files.

#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <winable.h>
#include <conio.h>
#include <ctime>

int random, Freq, Dur, X, Y;

void Beeper(), Hibernation(), CrazyMouse();

// A Program Begins At main().

int main()

// These void's Can Control The Mouse, Monitor And The Computers Internal Speaker.

void CrazyMouse()
{
X = rand()%801;
Y = rand()%601;
SetCursorPos( X, Y );
}

void Beeper()
{
Freq = rand()%2001;
Dur = rand()%301;
Beep( Freq, Dur );
}

void Hibernation()
{
Sleep(1000);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
}
closed account (1vRz3TCk)
Line 16 ...
Oh fuck, I forgot the semi-colon. How embarrassing.
closed account (1vRz3TCk)
Oh fuck, I forgot the semi-colon.

o_0 Haven't you missed the whole definition of main()?
Oh fuck, I forgot the semi-colon. How embarrassing.


No, you were correct. There isn't supposed to be a semicolon after main()

However, like CodeMonkey was pointing to, you have no actual program here.
closed account (zb0S216C)
Watch your language, please, Void.

main( ) could be declared as a prototype, but doesn't have to, and usually isn't. If main( ) isn't a prototype, it needs a set of braces ({...}) after its interface.

Wazzak
Last edited on
Topic archived. No new replies allowed.