first steps!

Hi all,

I am trying to start following the tutorials from the start, I installed visual studio community 2015, I had to install visual C library to get started, I choose a universal windows template, I am running the exact code as the intro to C tutorial says, but I got 2 errors


1
2
expected a declaration		
Error	C2447	'{': missing function header (old-style formal list?)


this is the code I wrote
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <windows.h>
#include <pch.h>

void foo(void)
{
	OutputDebugStringA("This is a test.\n");
}

int CALLBACK WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR     lpCmdLine,
	int       nCmdShow);
{
	foo();
}

any clue on where I might be going wrong here? thanks

Edit: nevermind, I think I found the culprit, that semicolon after the WinMain .

Edited by Adel on
Next time when you post an error message, please post it fully - including line number which maches code you are posting. So we can see what exactly is wrong (otherwise it will just a guessing game).

Edited by Mārtiņš Možeiko on
You have a stray ; after the WinMain function signature:

1
2
3
4
5
6
7
8
int CALLBACK WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR     lpCmdLine,
	int       nCmdShow); <--- Remove the ;
{
	foo();
}
That's exactly what OP is saying on last line :) (edit)

Edited by Mārtiņš Možeiko on