For some reason I can’t compile this program because I’m supposedly missing SDL. It compiles fine on Debug mode, but not Release. I am using Visual C++ 2010. I linked to SDL with VC++ directories. Here is my (little) code.
//main.cpp
#include "main.h"
void logger::log(string logging)
{
file << logging << "\n";
}
int main(int argc, char* argv[])
{
logger logObj;
logObj.log("uShootZombies started.");
SDL_Init(SDL_INIT_EVERYTHING);
logObj.log("SDL initalized.");
SDL_Quit();
logObj.log("SDL quit.");
return 0;
}
//main.h
#include <SDL.h>
#include <fstream>
#include <string>
using namespace std;
class game
{
public:
private:
};
class logger
{
public:
void log(string logging);
logger()
{
file.open("Log.txt", ios::out);
}
~logger()
{
file.close();
}
private:
ofstream file;
};
What am I doing wrong? If you need more info just ask. 😉
Be sure you added your library references to release mode as well as debug mode. I’m not 100% sure about SDL but some 3rd party libraries come with 2 flavors, debug & release. I believe you’ll have to setup the release mode of the IDE with the release mode of the library files.