I swear my compiler is just trying to piss me off

closed account (3qX21hU5)
So I finally gave in and headed back to Visual Studio's 2012 and this is what it gives me as a welcome home present.

1>  TileEngine.cpp
1>c:\users\brandon\documents\visual studio 2012\projects\tileengine\tileengine\tileengine.cpp(4): error C2533: 'TileEngine::{ctor}' : constructors not allowed a return type
1>  Main.cpp
1>c:\users\brandon\documents\visual studio 2012\projects\tileengine\tileengine\main.cpp(4): error C2628: 'TileEngine' followed by 'int' is illegal (did you forget a ';'?)
1>c:\users\brandon\documents\visual studio 2012\projects\tileengine\tileengine\main.cpp(5): error C2556: 'TileEngine WinMain(HINSTANCE,HINSTANCE,LPSTR,int)' : overloaded function differs only by return type from 'int WinMain(HINSTANCE,HINSTANCE,LPSTR,int)'
1>          c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2188) : see declaration of 'WinMain'
1>c:\users\brandon\documents\visual studio 2012\projects\tileengine\tileengine\main.cpp(5): error C2371: 'WinMain' : redefinition; different basic types
1>          c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2188) : see declaration of 'WinMain'
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Now the first and second errors are referring to line number 4 in my main.cpp file which looks like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <Windows.h>
#include "TileEngine.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)
{
	TileEngine engine;

	try
	{
		engine.Go();
	}
	catch(char *e)
	{
		MessageBoxA(NULL, e, "Exception Occured", MB_OK | MB_ICONERROR);
	}
}


As you can see I don't know how the heck the compiler is thinking WinMain is returning type TileEngine... And don't even get me started on the 'TileEngine' followed by 'int' is a illegal error ;p.

The other error in there is saying that my constructor for the class has a return type but yet when I go to the definition and declarition I see this

1
2
3
4
5
6
class TileEngine
{
public:
	TileEngine();
	~TileEngine();
//.... 



1
2
3
4
TileEngine::TileEngine()
{
	window.create(sf::VideoMode(800, 600, 32), "Engine Testing");
}


I have no clue what to make of these errors. Is Visual Studios just telling me that it doesn't like me and I should quit using it again? Or am I just so tired that I am missing something stupid? Anyways was wondering what you guys think or if you guys see anything that I am missing.
Last edited on
Did you forget the semicolon after the class declaration?
closed account (3qX21hU5)
Nope that was there, but I have managed to get it fixed. Just did a full re-install of Visual Studio's since when I tested the code in Code::blocks it worked just fine, and after the re-install it now compiles. So I don't know what went wrong there but I'm just going to write it down as a glitch in the compiler lol.
Topic archived. No new replies allowed.