Autor Tópico: Como instalar SDL no Gcc???  (Lida 11158 vezes)

Offline Natureba

  • Usuário Ubuntu
  • *
  • Mensagens: 290
    • Ver perfil
Como instalar SDL no Gcc???
« Online: 18 de Novembro de 2006, 20:23 »
Ae pessoal...
Desculpe a pergunta um tanto NB, mas eu queria saber como eu instalo a biblioteca SDL no gcc para compilar o jogo CUBE...
Eu procurei em alguns lugares, mas as informações estiveram sempre muito confusas e nao consegui o que eu queria... via apt-get achei uns programas tipo libsdl1.2-algumacoisa, soh que eu nao sabia se eu deveria baixar ou qual deveria baixar...

Alguem pode me ajudar???

OBS: Eu quero compilar o jogo Cube a fins de estudar a biblioteca SDL e a linguagem C, modificando seu conteudo e vendo os resultados, portanto dispenso ajudas como: "baixe o jogo ja compilado" , pois nao é isso que quero... o jogo compilado eu ja tenho....

Valeu...
Abraços... xD

Offline mientefuego

  • Usuário Ubuntu
  • *
  • Mensagens: 56
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #1 Online: 19 de Novembro de 2006, 07:35 »
Vc já usa o GCC p/ alguma coisa?

Se não, tenta baixar o pacote build-essential... Talvez funcione. Acho que um dos maiores micos do Ubuntu é não vir com esse pacote por padrão; apesar de ser uma distribuição completamente voltada ao usuário comum, é tradição as distros de Linux virem com o GCC já utilizável, sem precisar de mais nada.

Aliás q, bibilioteca SDL é essa? Nunca ouvi falar  :-[ ;D

Espero ter ajudado

[]'s

Offline AlexBR

  • Usuário Ubuntu
  • *
  • Mensagens: 388
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #2 Online: 19 de Novembro de 2006, 11:14 »
apt-get install libsdl1.2-dev

Offline mientefuego

  • Usuário Ubuntu
  • *
  • Mensagens: 56
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #3 Online: 19 de Novembro de 2006, 11:25 »
esse é meu garoto :P

Offline Natureba

  • Usuário Ubuntu
  • *
  • Mensagens: 290
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #4 Online: 19 de Novembro de 2006, 13:31 »
bom eu dei o apt-get install libsdl1.2-dev e instalou tudo certinho.... mas quando eu vou compilar o jogo com o comando:
Código: [Selecionar]
gcc -o cube main.cpp -lSDL
ele exibe milhares de erros:
Código: [Selecionar]
main.cpp: In function ‘void quit()’:
main.cpp:8: error: ‘writeservercfg’ was not declared in this scope
main.cpp:9: error: ‘disconnect’ was not declared in this scope
main.cpp:10: error: ‘cl’ was not declared in this scope
main.cpp:10: error: ‘strcmp’ was not declared in this scope
main.cpp:13: error: ‘SDL_ShowCursor’ was not declared in this scope
main.cpp:20: error: ‘SDL_Quit’ was not declared in this scope
main.cpp:21: error: ‘exit’ was not declared in this scope
main.cpp: In function ‘void fatal(char*, char*)’:
main.cpp:26: error: ‘msg’ was not declared in this scope
main.cpp:26: error: ‘s_sprintfd’ was not declared in this scope
main.cpp:27: error: ‘printf’ was not declared in this scope
main.cpp:31: error: ‘exit’ was not declared in this scope
main.cpp: At global scope:
main.cpp:34: error: expected constructor, destructor, or type conversion before ‘*’ token
main.cpp:39: error: expected constructor, destructor, or type conversion before ‘*’ token
main.cpp: In function ‘void screenshot()’:
main.cpp:45: error: ‘SDL_Surface’ was not declared in this scope
main.cpp:45: error: ‘image’ was not declared in this scope
main.cpp:46: error: ‘temp’ was not declared in this scope
main.cpp:48: error: ‘SDL_SWSURFACE’ was not declared in this scope
main.cpp:48: error: ‘SDL_CreateRGBSurface’ was not declared in this scope
main.cpp:52: error: ‘GL_RGB’ was not declared in this scope
main.cpp:52: error: ‘GL_UNSIGNED_BYTE’ was not declared in this scope
main.cpp:52: error: ‘glReadPixels’ was not declared in this scope
main.cpp:56: error: ‘memcpy’ was not declared in this scope
main.cpp:57: error: ‘endianswap’ was not declared in this scope
main.cpp:59: error: ‘buf’ was not declared in this scope
main.cpp:59: error: ‘s_sprintfd’ was not declared in this scope
main.cpp:60: error: ‘SDL_SaveBMP’ was not declared in this scope
main.cpp:61: error: ‘SDL_FreeSurface’ was not declared in this scope
main.cpp:63: error: ‘SDL_FreeSurface’ was not declared in this scope
main.cpp: At global scope:
main.cpp:67: error: expected constructor, destructor, or type conversion before ‘(’ token
main.cpp:68: error: expected constructor, destructor, or type conversion before ‘(’ token
main.cpp: In function ‘void computescreen(const char*)’:
main.cpp:73: error: ‘gettextres’ was not declared in this scope
main.cpp:74: error: ‘loopi’ was not declared in this scope
main.cpp:75: error: expected `;' before ‘{’ token
main.cpp: In function ‘void bar(float, int, int, float, float, float)’:
main.cpp:106: error: ‘glColor3f’ was not declared in this scope
main.cpp:107: error: ‘glVertex2f’ was not declared in this scope
main.cpp: In function ‘void show_out_of_renderloop_progress(float, const char*, float, const char*)’:
main.cpp:120: error: ‘gettextres’ was not declared in this scope
main.cpp:122: error: ‘GL_DEPTH_TEST’ was not declared in this scope
main.cpp:122: error: ‘glDisable’ was not declared in this scope
main.cpp:123: error: ‘GL_PROJECTION’ was not declared in this scope
main.cpp:123: error: ‘glMatrixMode’ was not declared in this scope
main.cpp:124: error: ‘glPushMatrix’ was not declared in this scope
main.cpp:125: error: ‘glLoadIdentity’ was not declared in this scope
main.cpp:126: error: ‘glOrtho’ was not declared in this scope
main.cpp:129: error: ‘GL_QUADS’ was not declared in this scope
main.cpp:129: error: ‘glBegin’ was not declared in this scope
main.cpp:143: error: ‘glEnd’ was not declared in this scope
main.cpp:145: error: ‘GL_BLEND’ was not declared in this scope
main.cpp:145: error: ‘glEnable’ was not declared in this scope
main.cpp:146: error: ‘GL_TEXTURE_2D’ was not declared in this scope
main.cpp:149: error: ‘draw_text’ was not declared in this scope
main.cpp:150: error: ‘draw_text’ was not declared in this scope
main.cpp:155: error: ‘glPopMatrix’ was not declared in this scope
main.cpp:157: error: ‘SDL_GL_SwapBuffers’ was not declared in this scope
main.cpp: In function ‘void fullscreen()’:
main.cpp:165: error: ‘screen’ was not declared in this scope
main.cpp:165: error: ‘SDL_WM_ToggleFullScreen’ was not declared in this scope
main.cpp:166: error: ‘SDL_FULLSCREEN’ was not declared in this scope
main.cpp:166: error: ‘SDL_GRAB_ON’ was not declared in this scope
main.cpp:166: error: ‘SDL_GRAB_OFF’ was not declared in this scope
main.cpp:166: error: ‘SDL_WM_GrabInput’ was not declared in this scope
main.cpp: In function ‘void screenres(int*, int*, int*)’:
main.cpp:175: error: ‘SDL_Surface’ was not declared in this scope
main.cpp:175: error: ‘surf’ was not declared in this scope
main.cpp:175: error: ‘SDL_OPENGL’ was not declared in this scope
main.cpp:175: error: ‘SDL_RESIZABLE’ was not declared in this scope
main.cpp:175: error: ‘screen’ was not declared in this scope
main.cpp:175: error: ‘SDL_FULLSCREEN’ was not declared in this scope
main.cpp:175: error: ‘SDL_SetVideoMode’ was not declared in this scope
main.cpp:180: error: ‘glViewport’ was not declared in this scope
main.cpp: At global scope:
main.cpp:184: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp:185: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp: In function ‘void keyrepeat(bool)’:
main.cpp:189: error: ‘SDL_DEFAULT_REPEAT_DELAY’ was not declared in this scope
main.cpp:190: error: ‘SDL_DEFAULT_REPEAT_INTERVAL’ was not declared in this scop e
main.cpp:190: error: ‘SDL_EnableKeyRepeat’ was not declared in this scope
main.cpp: At global scope:
main.cpp:193: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp:202: error: expected constructor, destructor, or type conversion before  ‘<’ token
main.cpp:203: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp:203: error: expected unqualified-id before ‘)’ token
main.cpp:204: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp: In function ‘void estartmap(const char*)’:
main.cpp:209: error: ‘gamespeed’ was not declared in this scope
main.cpp:210: error: ‘paused’ was not declared in this scope
main.cpp:211: error: ‘sleepcmds’ was not declared in this scope
main.cpp:211: error: ‘loopv’ was not declared in this scope
main.cpp:211: error: expected `;' before ‘delete’
main.cpp:214: error: ‘pruneundos’ was not declared in this scope
main.cpp:215: error: ‘setvar’ was not declared in this scope
main.cpp:216: error: ‘cl’ was not declared in this scope
main.cpp: At global scope:
main.cpp:219: error: expected constructor, destructor, or type conversion before  ‘(’ token
main.cpp: In function ‘void limitfps(int&, int)’:
main.cpp:224: error: ‘maxfps’ was not declared in this scope
main.cpp:236: error: ‘SDL_Delay’ was not declared in this scope
main.cpp: In function ‘int main(int, char**)’:
main.cpp:283: error: ‘SDL_FULLSCREEN’ was not declared in this scope
main.cpp:284: error: ‘NULL’ was not declared in this scope
main.cpp:287: error: ‘puts’ was not declared in this scope
main.cpp:294: error: ‘atoi’ was not declared in this scope
main.cpp:304: error: ‘max’ was not declared in this scope
main.cpp:304: error: ‘min’ was not declared in this scope
main.cpp:310: error: ‘path’ was not declared in this scope
main.cpp:310: error: ‘strstr’ was not declared in this scope
main.cpp:315: error: ‘conoutf’ was not declared in this scope
main.cpp:317: error: ‘conoutf’ was not declared in this scope
main.cpp:330: error: ‘SDL_INIT_TIMER’ was not declared in this scope
main.cpp:330: error: ‘SDL_INIT_VIDEO’ was not declared in this scope
main.cpp:330: error: ‘SDL_INIT_AUDIO’ was not declared in this scope
main.cpp:330: error: ‘SDL_Init’ was not declared in this scope
main.cpp:330: error: ‘SDL_GetError’ was not declared in this scope
main.cpp:333: error: ‘enet_initialize’ was not declared in this scope
main.cpp:24: error: too few arguments to function ‘void fatal(char*, char*)’
main.cpp:333: error: at this point in file
main.cpp:338: error: ‘SDL_GL_DOUBLEBUFFER’ was not declared in this scope
main.cpp:338: error: ‘SDL_GL_SetAttribute’ was not declared in this scope
main.cpp:339: error: ‘SDL_GL_DEPTH_SIZE’ was not declared in this scope
main.cpp:342: error: ‘SDL_GL_MULTISAMPLEBUFFERS’ was not declared in this scope
main.cpp:343: error: ‘SDL_GL_MULTISAMPLESAMPLES’ was not declared in this scope
main.cpp:345: error: ‘screen’ was not declared in this scope
main.cpp:345: error: ‘SDL_OPENGL’ was not declared in this scope
main.cpp:345: error: ‘SDL_RESIZABLE’ was not declared in this scope
main.cpp:345: error: ‘SDL_SetVideoMode’ was not declared in this scope
main.cpp:346: error: ‘SDL_GetError’ was not declared in this scope
main.cpp:349: error: ‘SDL_WM_SetCaption’ was not declared in this scope
main.cpp:353: error: ‘SDL_GRAB_ON’ was not declared in this scope
main.cpp:353: error: ‘SDL_WM_GrabInput’ was not declared in this scope
main.cpp:355: error: ‘SDL_ShowCursor’ was not declared in this scope
main.cpp:359: error: ‘execfile’ was not declared in this scope
main.cpp:24: error: too few arguments to function ‘void fatal(char*, char*)’
main.cpp:359: error: at this point in file
main.cpp:24: error: too few arguments to function ‘void fatal(char*, char*)’
main.cpp:364: error: at this point in file
main.cpp:370: error: ‘camera1’ was not declared in this scope
main.cpp:370: error: ‘player’ was not declared in this scope
main.cpp:370: error: ‘cl’ was not declared in this scope
main.cpp:371: error: ‘empty_world’ was not declared in this scope
main.cpp:374: error: ‘initsound’ was not declared in this scope
main.cpp:377: error: ‘newmenu’ was not declared in this scope
main.cpp:379: error: ‘exec’ was not declared in this scope
main.cpp:384: error: ‘execfile’ was not declared in this scope
main.cpp:394: error: ‘string’ was not declared in this scope
main.cpp:394: error: expected `;' before ‘gamecfgname’
main.cpp:395: error: ‘gamecfgname’ was not declared in this scope
main.cpp:395: error: ‘s_strcpy’ was not declared in this scope
main.cpp:396: error: ‘s_strcat’ was not declared in this scope
main.cpp:404: error: ‘cc’ was not declared in this scope
main.cpp:414: error: ‘SDL_GetTicks’ was not declared in this scope
main.cpp:417: error: ‘gamespeed’ was not declared in this scope
main.cpp:420: error: ‘paused’ was not declared in this scope
main.cpp:421: error: ‘worldpos’ was not declared in this scope
main.cpp:422: error: ‘sleepcmds’ was not declared in this scope
main.cpp:422: error: ‘loopv’ was not declared in this scope
main.cpp:423: error: expected `;' before ‘{’ token
main.cpp:437: error: ‘time’ was not declared in this scope
main.cpp:446: error: ‘SDL_GL_SwapBuffers’ was not declared in this scope
main.cpp:451: error: ‘SDL_Event’ was not declared in this scope
main.cpp:451: error: expected `;' before ‘event’
main.cpp:453: error: ‘event’ was not declared in this scope
main.cpp:453: error: ‘SDL_PollEvent’ was not declared in this scope
main.cpp:457: error: ‘SDL_QUIT’ was not declared in this scope
main.cpp:462: error: ‘SDL_VIDEORESIZE’ was not declared in this scope
main.cpp:467: error: ‘SDL_KEYDOWN’ was not declared in this scope
main.cpp:468: error: ‘SDL_KEYUP’ was not declared in this scope
main.cpp:469: error: ‘SDL_PRESSED’ was not declared in this scope
main.cpp:469: error: ‘keypress’ was not declared in this scope
main.cpp:472: error: ‘SDL_ACTIVEEVENT’ was not declared in this scope
main.cpp:473: error: ‘SDL_APPINPUTFOCUS’ was not declared in this scope
main.cpp:480: error: ‘SDL_MOUSEMOTION’ was not declared in this scope
main.cpp:485: error: ‘SDL_WarpMouse’ was not declared in this scope
main.cpp:493: error: ‘SDL_MOUSEBUTTONDOWN’ was not declared in this scope
main.cpp:494: error: ‘SDL_MOUSEBUTTONUP’ was not declared in this scope

e isso por que ainda nao couberam todos os erros no terminal e todos que couberam no terminal nao foram permitidos pelo forum devido ao tamanho da mensagem...
o que estou fazendo de errado??? será que é o comando???
alguem sabe o que pode ser???

Valeu.
Falou.

Offline mientefuego

  • Usuário Ubuntu
  • *
  • Mensagens: 56
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #5 Online: 20 de Novembro de 2006, 00:05 »
tenta baixar o build-essential, sério...

talvez funcione.

Offline daskrs

  • Usuário Ubuntu
  • *
  • Mensagens: 84
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #6 Online: 20 de Novembro de 2006, 04:18 »
Abre o makefile do Source do Cube e copia aqui pra a gente ver quais libs ele usa.

Offline AlexBR

  • Usuário Ubuntu
  • *
  • Mensagens: 388
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #7 Online: 21 de Novembro de 2006, 07:22 »
Você mostrou apenas a parte final do log de erros. Deixou o mais importante, ou seja, o início, de fora. Antes desse ponto, deve aparecer o primeiro erro, o que causou todos os outros. Normalmente, é a falta de um arquivo cabeçalho *.h. Você deve ver qual é esse cabeçalho e procurar em qual pacote está o cabeçalho faltoso. Depois, é só instalar o pacote e tentar novamente.

Boa sorte!

Offline Natureba

  • Usuário Ubuntu
  • *
  • Mensagens: 290
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #8 Online: 22 de Novembro de 2006, 23:35 »
ao instalar build-essential o apt-get fala que ja possuo a versão mais nova...

o makefile do Cube:
Código: [Selecionar]
CXX=g++
CXXOPTFLAGS=-Wall -fsigned-char -O3 -fomit-frame-pointer
CXXFLAGS=$(CXXOPTFLAGS) -Ienet/include -I. -Ishared -Iengine -Ifpsgame `sdl-config --cflags`

PLATFORM_PREFIX=linux
CLIENT_LIBS=-Lenet -lenet `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL -lGLU
CLIENT_OBJS= \
shared/tools.o \
shared/geom.o \
engine/client.o \
engine/command.o \
engine/console.o \
engine/cubeloader.o \
engine/lightmap.o \
engine/main.o \
engine/menus.o \
engine/normal.o \
engine/octa.o \
engine/octaedit.o \
engine/octarender.o \
engine/physics.o \
engine/renderextras.o \
engine/rendergl.o \
engine/rendermodel.o \
engine/renderparticles.o \
engine/rendertext.o \
engine/server.o \
engine/serverbrowser.o \
engine/spheretree.o \
engine/sound.o \
engine/treeui.o \
engine/water.o \
engine/world.o \
engine/worldio.o \
fpsgame/fps.o \
rpggame/rpg.o

SERVER_LIBS=-Lenet -lenet
SERVER_OBJS= \
shared/tools.o \
engine/server-standalone.o \
fpsgame/fps-standalone.o

default: all

all: libenet client server

enet/Makefile:
cd enet; ./configure

libenet: enet/Makefile
$(MAKE) -C enet/ all

clean: enet/Makefile
-$(RM) $(SERVER_OBJS) $(CLIENT_OBJS) sauer_server sauer_client
$(MAKE) -C enet/ clean

engine/server-standalone.o:
$(CXX) $(CXXFLAGS) -DSTANDALONE -c -o engine/server-standalone.o engine/server.cpp

fpsgame/fps-standalone.o:
$(CXX) $(CXXFLAGS) -DSTANDALONE -c -o fpsgame/fps-standalone.o fpsgame/fps.cpp

client: $(CLIENT_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS)

server: $(SERVER_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) 

install: all
cp sauer_client ../bin_unix/$(PLATFORM_PREFIX)_client
cp sauer_server ../bin_unix/$(PLATFORM_PREFIX)_server
strip ../bin_unix/$(PLATFORM_PREFIX)_client
strip ../bin_unix/$(PLATFORM_PREFIX)_server

e o começo dos erros nao consegui pegar (como ja tinha dito) pois o terminal nao mostra tudo pois o erro é muito grande...

Abraços...
Natureba.

Offline AlexBR

  • Usuário Ubuntu
  • *
  • Mensagens: 388
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #9 Online: 23 de Novembro de 2006, 06:48 »
Cara, sem ver o início dos erros, vai ser complicado resolver o seu problema.

Você manda compilar, quando chegar no ponto que você perceber que já está dando erro, vc tecla ctrl+C.

Darcamo

  • Visitante
Re: Como instalar SDL no Gcc???
« Resposta #10 Online: 23 de Novembro de 2006, 12:16 »
Esses erros que vc exibiu são apenas consequências e não a causa do problema. A causa certamente é algum arquivo de cabeçalho que ou não foi incluído ou não foi encontrado. Erros desse tipo aparecem no começo e causam várias outras mensagens de erro depois. Por isso precisamos ver o início dos erros como o AlexBR mencionou.

De qualquer forma, além do libsdl1.2-dev você também precisa dos pacotes libsdl-image1.2-dev e libsdl-mixer1.2-dev

Talvez também precise dos pacotes libsdl-net1.2-dev, libsdl-sound1.2-dev, libsdl-ttf1.2-dev ou libsdl-ttf2.0-dev.

Offline Natureba

  • Usuário Ubuntu
  • *
  • Mensagens: 290
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #11 Online: 23 de Novembro de 2006, 22:39 »
Ok... mas o único meio de pegar o começo dos erros mesmo é mandar o terminal salvar o log dos erros em um arquivo, pois os erros aparecem muito rapido e nao da tempo de um ctrl+c ...
eu nao lembro o comando para o terminal salvar a saída de um comando em um arquivo txt... alguem sabe como eu faço???
acho que era alguma coisa a ver com a inclusão de um "> log.txt" no comando, mas nao tenho certeza...

Abraços.
Falou...

Offline e.daniel-ct

  • Usuário Ubuntu
  • *
  • Mensagens: 210
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #12 Online: 24 de Novembro de 2006, 11:34 »
pelo q eu entendi ai a bibilhoteca sdl ainda nao esta instalada, falo isso pq tive o mesmo problema aki so q eu peguei essa bibilhoteca no tar.gz e compilei, nao lembro nem o jogo q eu tava tentando instala mais sei q depois de muito tenta cabei desistindo, se vc consgui resolve o problema eu também agradeço valeu

Darcamo

  • Visitante
Re: Como instalar SDL no Gcc???
« Resposta #13 Online: 25 de Novembro de 2006, 00:05 »
A SDL tem nos repositórios. Então é muito mais fácil instalar por eles do que compilar.
Quanto a jogar os erros no arquivo de texto acho que é só colocar depois do comando
>> log.txt

« Última modificação: 25 de Novembro de 2006, 17:33 por Darcamo »

Offline e.daniel-ct

  • Usuário Ubuntu
  • *
  • Mensagens: 210
    • Ver perfil
Re: Como instalar SDL no Gcc???
« Resposta #14 Online: 25 de Novembro de 2006, 12:38 »
É mais aki estamos falando da lib sdl q como vc pode ver é indicado entre os erros a falta de funções q tem exatamente o nome iniciando com essa lib pra ser mais exato a ki eu compilei foi a SDL-1.2.11.tar.gz, blz