Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup MSVCRTD.lib 2dhouse
Error 2 fatal error LNK1120: 1 unresolved externals C:\Users\william\Documents\Visual Studio 2008\Projects\2dhouse\Debug\2dhouse.exe 2dhouse
unable to start program: c:/e.t.c/doc/visual09/myprog/deub/myprog.exe
WTF! what is this debug folder for. here is my code:
cpp
#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL_image.lib")
#endif
#include "stdafx.h"
#include <windows.h>
#include <GL/glut.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
#include <SDL.h>
#include <SDL_opengl.h>
#define TRUE 1
#define FALSE 0
const int windowWidth=300;
const int windowHeight=400;
const int numVertices=5;
const int numEdges=6;
const float vertices[numVertices][2] = {{0.0,0.0},{100.0,0.0},{0.0,100.0},{100.0,100.0},{50.0,150.0}};
const int edges[numEdges][2] = {{0,1},{1,3},{3,2},{2,0},{2,4},{3,4}};
const int edges2[4][2] = {{0,2},{2,3},{3,1},{1,0}};
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
class SpaceShip {
int x, y, SpaceShipWidth;
public:
void move_ship (int x,int y ) {
//displace xy
}
void set_values (int shipWidth, int xCoord, int yCoord) {
SpaceShipWidth = shipWidth;
x = xCoord;
y = yCoord;
}
};
void setStartValues(void) {
SpaceShip ship;
ship.set_values(50, (windowWidth / 2) - 50,windowHeight - 40);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 0.0, 0.0);
glPointSize(3.0);
glBegin(GL_LINES);
for(int i=0;i<numEdges;i++)
{
glVertex2fv(vertices[edges[i][0]]);
glVertex2fv(vertices[edges[i][1]]);
}
glEnd();
//glDrawPixels(checkImageWidth, checkImageHeight, GL_RGB,
//GL_UNSIGNED_BYTE, checkImage);
glFlush ();
}
void init(void)
{
glClearColor (0.246, 0.33, 0.422, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLdouble halfWidth=(GLdouble) windowWidth/2.0;
GLdouble halfHeight=(GLdouble) windowHeight/2.0;
gluOrtho2D(0, windowWidth, windowHeight, 0);
}
void keyboard (unsigned char key, int x, int y) {
switch (key) {
case GLUT_KEY_LEFT :
break;
case GLUT_KEY_UP :
break;
case GLUT_KEY_RIGHT :
break;
case GLUT_KEY_DOWN :
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(windowWidth, windowHeight);
glutInitWindowPosition(100, 100);
glutCreateWindow("My first OpenGL program");
init ();
glutDisplayFunc(display);
glutKeyboardFunc (keyboard);
setStartValues();
glutMainLoop();
return 0;
}