【发布时间】:2010-11-11 22:59:10
【问题描述】:
由于某种原因,我无法编译该程序,因为据说我缺少 SDL。它在调试模式下编译得很好,但不是发布。我正在使用 Visual C++ 2010。我使用 VC++ 目录链接到 SDL。这是我的(小)代码。
//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;
};
我做错了什么?如果您需要更多信息,请询问。 ;)
【问题讨论】:
-
在 Visual Studio 中,不同的配置(Debug、Release、不同的 CPU)有不同的设置。即使您为 Debug 添加了正确的目录和库,您也必须对 Release 进行相同的更改才能正确编译。
-
您确定要在两种配置(调试和发布)中链接 SDL 库吗?
标签: c++ visual-studio visual-c++ sdl