我不知道为什么这段代码不起作用.所有的源文件都编译好了,但是当我尝试链接它们时,编译器会因为未定义的引用错误而对我大喊大叫.这是代码:
main.cpp中:
#include "SDL/SDL.h"
#include "Initilize.cpp"
int main(int argc, char* args[])
{
//Keeps the program looping
bool quit = false;
SDL_Event exit;
//Initilizes, checks for errors
if(Initilize::Start() == -1)
{
SDL_Quit();
}
//main program loop
while(quit == false)
{
//checks for events
while(SDL_PollEvent(&exit))
{
//checks for type of event;
switch(exit.type)
{
case SDL_QUIT:
quit = true;
break;
}
}
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
Initilize.h:
#ifndef INITILIZE_H
#define INITILIZE_H
#include "SDL/SDL.h"
/* Declares surface screen, its attributes, and Start(); */
class …Run Code Online (Sandbox Code Playgroud)