Hello am having a problem with my IDE Visual Studio 2012. I have started to learn SDL so am quite new to it and I am trying apply good structure when using SDL. The problems lays when I start using SDL with classes. It works fine if I type everything in main. I don't know what am doing wrong can you help here are the errors
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _exit already defined in LIBCMT.lib (crt0dat.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\User\documents\visual studio 2012\Projects\Nebula\Debug\Nebula.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is my code if there is something wrong
Main
#include <SDL.h>
#include "System.h"
int main(int argc, char* argv[])
{
System RedObject;
RedObject.SetUp();
SDL_Quit();
return 0;
}
Second file.
#include "System.h"
System::System()
{
}
System::~System()
{
}
void System::SetUp()
{
SDL_Init(SDL_INIT_EVERYTHING); // The SDL Set up bit.
SDL_Surface * screen;
SDL_WM_SetCaption("Window Name", NULL);
fullscreen = false;
if(fullscreen == true)
{
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE | SDL_FULLSCREEN);
}
else
{
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
}
bool running = true;
while(running)
{
SDL_Event Event;
while(SDL_PollEvent(&Event))
{
switch(Event.type)
case SDL_QUIT:
running = false;
break;
}
SDL_Flip(screen);
}
}
Second Files Header:
#ifndef SYSTEM_H
#define SYSTEM_H
#include <SDL.h>
class System
{
private:
int SHeight, SLenght;
bool fullscreen;
public:
System();
~System();
void SetUp();
};
#endif
Also I have set up the IDE code generator to run on Multi-threaded DLL (/MD) I don't know if that is the problem. Sorry if this question has been already answered I could find an answer. Thank you in advance.