Beginner with small error (please help!)

Jan 20, 2015 at 7:09pm
Hello, I am new to C++ and I am trying to call a function. I wrote this code with experience in other languages thinking it would work. I am getting an error 'expected a declaration'. It is a very basic print line just to check how functions work in C++. The winmain function is because I was getting an error earlier asking for something called winmain. 'unresolved external symbol _WinMain@16 referenced in function' Anyway here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  #include<Windows.h>
//Testing the function named foo
void foo(void)
{
	//this is what the function is going to do
	OutputDebugStringA("This is outputting to the debug string and it is the first thing I have ever printed in C++.\n");
}
//using winmain due to error caused earlier see post found on MSDN
int CALLBACK WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpCmdLine,
	int nCmdShow);
{
	foo();
}


EDIT: got it working, removed the ; after int nCmdShow)
Last edited on Jan 20, 2015 at 8:21pm
Jan 20, 2015 at 7:58pm
closed account (SECMoG1T)
Hi am new to C++  well if you're a real newbie , why not start learning about c++ basics before moving directly into Windows programming, life would be abit easier for you- piece of advice ;)
Last edited on Jan 20, 2015 at 8:10pm
Jan 20, 2015 at 8:19pm
appreciate this but I am one of those people who refuses to move on to another piece of code whilst one of their pieces of code has an error.
Jan 20, 2015 at 8:47pm
closed account (SECMoG1T)
Perfect approach to get things right, +1.
Topic archived. No new replies allowed.