Archived

This topic is now archived and is closed to further replies.

Chryzmo

SDL Project Compile Error

Recommended Posts

Heyas, I just recently decided to try SDL. The first app I compiled was the first tutorial from Cone3D that I compiled real fast to make sure SDL was set up correctly. It worked at the time. However, now I am trying to compile the project I am working on and it gives me an error. Here is the error: SDL Test error LNK2019: unresolved external symbol _SDL_main referenced in function _main SDL Test fatal error LNK1120: 1 unresolved externals Here is my source so far(I was just prototyping the functions)

// main.cpp


#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif

#include "SDL.h"

#include <stdio.h>
#include <stdlib.h>

#include "SDLTest.h"


int main()
{
	SDL_Init(SDL_INIT_VIDEO);

	SDL_Quit();

	return 0;
}

// SDLTest.h


#include <SDL.h>

#ifndef SDLTest_H
#define SDLTest_H

class cDisplay
{
	public:
		cDisplay();
		~cDisplay();
		int InitImages();
		void DrawImg(SDL_Surface *img, int x, int y);
		void DrawImg(SDL_Surface *img, int x, int y, int w, int h, int x2, int y2);
		void DrawBG();
		void DrawScene(SDL_Surface *image, int xpos, int ypos);
        
	private:
		SDL_Surface *back;
		SDL_Surface *screen;
		int xpos;
		int ypos;

};

class cBox
{
	public:
		cBox();
		~cBox();
		SDL_Surface ShowImage();
		int ShowXpos();
		int ShowYpos();

	private:
		SDL_Surface *image;
		int xpos;
		int ypos;
};

#endif

// I do not have anything except the Constructor and Destructors in any .cpp files, as I thought those were all taht was needed to get a class to compile without complaining.


The website I used to setup VC++ for SDL was http://pgdc.purdue.org/sdltutorial/sdl_setup.html I am using Visual C++.NET 2003. I set up the lib and include directories just like that site told me to. I am completely stumped. Hopefully someone else can help? Thanks, Chris

Share this post


Link to post
Share on other sites
main needs to receive an int and and array of pointers... i thin its some info that SDL needs to set up the window, like the users resolution or something.. anyway, just do

int main(int argc, char *argv[])



[edited by - graveyard filla on March 17, 2004 10:48:18 PM]

Share this post


Link to post
Share on other sites
Great! Thanks so much for your reply! It works just fine now, I must have just over looked that little bit.

Thanks again,
Chris

Share this post


Link to post
Share on other sites