Sascha1986
Grünschnabel
Also ich hab folgendes Problem und bin total überfragt, außerdem noch ziemlicher Anfänger.
Ich versuche in meinem Programm das ich in VS 2010 schreibe, die SDL_TTF.lib einzubinden. Ich habe das Include-Verzeichnis richtig angeben und auch das Lib-Verzeichnis, außerdem hab ich auch die benötigten Libs im Linker. SubSystem ist Windows und Laufzeitbib ist auf Multithreaded_DLL(/MD). Desweitern sind alle dlls in meinem Projekt-Ordner. Hatte auch beim Einbinden von SDL_image.lib keine Probleme.
mein Programmcode sieht wie folgt aus:
Und der Fehler beim Kompilieren ist der folgende:
LINK : fatal error LNK1104: Datei "#include \SDL_ttf.h\.obj" kann nicht geöffnet werden.
Ich wäre echt für jede Hilfe dankbar, bin ziemlich überfragt :-(
PS:Hab Bilder der Include, Lib und Linker Einstellungen und des Ordners E:\SDL-1.2.14\include und lib angehängt!
Ich versuche in meinem Programm das ich in VS 2010 schreibe, die SDL_TTF.lib einzubinden. Ich habe das Include-Verzeichnis richtig angeben und auch das Lib-Verzeichnis, außerdem hab ich auch die benötigten Libs im Linker. SubSystem ist Windows und Laufzeitbib ist auf Multithreaded_DLL(/MD). Desweitern sind alle dlls in meinem Projekt-Ordner. Hatte auch beim Einbinden von SDL_image.lib keine Probleme.
mein Programmcode sieht wie folgt aus:
Code:
#include <SDL.h>
#include <string>
#include <SDL_ttf.h>
#include <SDL_image.h>
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP=32;
SDL_Surface* message = NULL;
SDL_Surface* character = NULL;
SDL_Surface* background = NULL;
SDL_Surface* screen = NULL;
TTF_Font* font = NULL;
SDL_Color textColor ={255,255,255};
SDL_Event event;
SDL_Surface* load_Image(std::string filename)
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;
loadedImage = IMG_Load(filename.c_str());
if(loadedImage != NULL)
{
optimizedImage = SDL_DisplayFormat(loadedImage);
SDL_FreeSurface(loadedImage);
}
if(optimizedImage!=NULL)
{
Uint32 colorkey = SDL_MapRGB(optimizedImage->format, 0,0xFF,0xFF);
SDL_SetColorKey(optimizedImage,SDL_SRCCOLORKEY,colorkey);
}
return optimizedImage;
}
void apply_surface(int x, int y,SDL_Surface* source,SDL_Surface* destination)
{
SDL_Rect offset;
offset.x = NULL;
offset.y = NULL;
SDL_BlitSurface(source,NULL,destination,&offset);
}
bool init()
{
if(SDL_Init(SDL_INIT_EVERYTHING)==-1)
{
return false;
}
screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,SDL_SWSURFACE);
if(screen==NULL)
{
return false;
}
if(TTF_Init()==-1)
{
return false;
}
SDL_WM_SetCaption("Testspiel",NULL);
return true;
}
bool load_files()
{
character = load_Image("figur.png");
background =load_Image("background.png");
font = TTF_OpenFont("ARIAL.ttf",28);
if(character == NULL)
{
return false;
}
if(background == NULL)
{
return false;
}
if(font == NULL)
{
return false;
}
return true;
}
void clean_up()
{
SDL_FreeSurface(character);
SDL_FreeSurface(message);
SDL_FreeSurface(background);
TTF_CloseFont(font);
TTF_Quit();
SDL_Quit();
}
int main(int argsc, char*args[])
{
bool quit = false;
if(init()==false)
{
return 1;
}
if(load_files()==false)
{
return 1;
}
message = TTF_RenderText_Solid(font,"Hey, I'm a Spaceship!",textColor);
if(message==NULL)
{
return 1;
}
apply_surface(0,0,background,screen);
apply_surface( 320, 0, background, screen );
apply_surface( 0, 240, background, screen );
apply_surface( 320, 240, background, screen );
apply_surface( 180, 140, character, screen );
apply_surface( 0, 150, message, screen );
if(SDL_Flip(screen)==-1)
{
return 1;
}
while(quit==false)
{
while(SDL_PollEvent(&event))
{
if(event.type==SDL_QUIT)
{
quit = true;
clean_up();
return 0;
}
}
}
}
Und der Fehler beim Kompilieren ist der folgende:
LINK : fatal error LNK1104: Datei "#include \SDL_ttf.h\.obj" kann nicht geöffnet werden.
Ich wäre echt für jede Hilfe dankbar, bin ziemlich überfragt :-(
PS:Hab Bilder der Include, Lib und Linker Einstellungen und des Ordners E:\SDL-1.2.14\include und lib angehängt!
Anhänge
Zuletzt bearbeitet: