Handmade Network»Forums
Adel
1 posts
first steps!
Edited by Adel on
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 .
Mārtiņš Možeiko
2562 posts / 2 projects
first steps!
Edited by Mārtiņš Možeiko 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).
1 posts
first steps!
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();
}
Mārtiņš Možeiko
2562 posts / 2 projects
first steps!
Edited by Mārtiņš Možeiko on
That's exactly what OP is saying on last line :) (edit)