Article 4SV0S undefined reference to /usr/local/lib/libSDL2_ttf.so undefined reference to `SDL_RWseek

undefined reference to /usr/local/lib/libSDL2_ttf.so undefined reference to `SDL_RWseek

by
rahulvishwakarma
from LinuxQuestions.org on (#4SV0S)
hi to all, I've centos7.5 in VM. I am trying to compile to SDL2 program. but having following problem :-
Code:/usr/local/lib/libSDL2_ttf.so||undefined reference to `SDL_RWseek'|
/usr/local/lib/libSDL2_ttf.so||undefined reference to `SDL_RWclose'|
/usr/local/lib/libSDL2_ttf.so||undefined reference to `SDL_RWtell'|
/usr/local/lib/libSDL2_ttf.so||undefined reference to `SDL_RWsize'|
/usr/local/lib/libSDL2_ttf.so||undefined reference to `SDL_RWread'|
||error: ld returned 1 exit status|mine source code is :-
Code:#include <SDL.h>
#include <SDL/SDL_image.h>
#include <SDL_ttf.h>

#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;

int main(int argc, char ** argv)
{

SDL_Texture *currentImagetexture = nullptr;
SDL_Surface * currentImage = nullptr;
SDL_Renderer *renderer = nullptr;
SDL_Window * sdlWindow = nullptr;
SDL_Surface *windowsurface = SDL_GetWindowSurface(sdlWindow);

if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
std ::cout <<"Error in ... if(SDL_Init(SDL_INIT_EVERYTHING) <0) : " << SDL_GetError() << endl;
}

if((sdlWindow = SDL_CreateWindow("Game engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,1024, 768, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL)) < 0)
{
std ::cout <<"Error in ... sdlWindow = SDL_CreateWindow : "<< SDL_GetError() << endl;
exit(2);
}

if(TTF_Init() < 0 )
{
cout << " Error ... TTF_Init() < 0 ) " << TTF_GetError() << endl;
exit(4);
}

windowsurface = SDL_GetWindowSurface(sdlWindow);

renderer = SDL_CreateRenderer(sdlWindow,-1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);

SDL_Event *ev = new SDL_Event;

TTF_Font *font = TTF_OpenFont("Roboto-Black.ttf",20);
SDL_Color color = {0,0,0,255};
SDL_Surface *text_surface = TTF_RenderText_Solid(font, "rahul", color);
SDL_Texture * text = SDL_CreateTextureFromSurface(renderer, windowsurface);

SDL_Rect rect;
rect.x = rect.y =0;

SDL_QueryTexture(text, NULL, NULL,&rect.w, &rect.h);

bool isRunning = true;

while(isRunning)
{
while (SDL_PollEvent(ev))
{
if(ev->type == SDL_QUIT)
{
isRunning = false;
}

}
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, text, NULL, &rect);
SDL_RenderPresent(renderer);
}

SDL_FreeSurface(windowsurface);
SDL_FreeSurface(currentImage);

SDL_DestroyRenderer(renderer);

SDL_DestroyTexture(currentImagetexture);
SDL_DestroyWindow(sdlWindow);

windowsurface = nullptr;
currentImage = nullptr;
sdlWindow = nullptr;
SDL_Quit();

return 0;
}how to remove those errorslatest?d=yIl2AUoC8zA latest?i=eyIKDe49OIs:9wQagmznvJk:F7zBnMy latest?i=eyIKDe49OIs:9wQagmznvJk:V_sGLiP latest?d=qj6IDK7rITs latest?i=eyIKDe49OIs:9wQagmznvJk:gIN9vFweyIKDe49OIs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments