Header issue

closed account (NUj6URfi)
I am working on using c++ to make a 2d action game and I am using dev-c++. When I include this header I get the error
[Linker error] undefined reference to `WinMain@16'.
This is the header code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 //Allows a header file to be a header file
#ifndef _SDL_GOVvsHR_H_
    #define _SDL_GOVvsHR_H_
//Basic libraries
#include <iostream>
#include <string>
#include <SDL.h>

using namespace std;

//blank function
void SDL_GOVvsHR() {
     cout << "Welcome to Goverment vs Heavy Rock.";
     cin.get();
     return;
}
//Ends the special header file stuff
#endif
#undef  _SDL_GOVvsHR_H_


What is the problem here?
closed account (NUj6URfi)
Bump.
closed account (NUj6URfi)
Anyone?
Well, you should tell us what line your getting that error. First, I believe SDL.h is from a tutorial, you need to put that in the same folder as your project files and it should be:

#include "SDL.h"

Because it is not in the standard library and is a header your including.

Your function on line 12, it returns void, no need for line 15

On line 14 you use the member function get of cin and have not included any arguments. http://www.cplusplus.com/reference/istream/istream/get/

Finally you dont put #undef and the end of your header.

You have to be more detailed in your question, also insure that it is the only problem in your code for us to easily help you.

Last edited on
Topic archived. No new replies allowed.