[SDL] [perhaps a little bit off] strange linking problem with SDL and OpenGL

Alexander Bierbrauer alex at polyfrag.com
Thu Jan 10 04:32:01 PST 2002


Hi people,

I want to compile an app which uses SDL and OpenGL. When I want to
compile via make and get the follwing strange error... I really don't
know any further....cSouse_Input uses the keyboard functions of SDL... sorry, if this is much too off-topic.


cSouse_Input.o: In function
`__malloc_alloc_template<0>::_S_oom_malloc(unsigned
int)':
cSouse_Input.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x19): undefined reference to `endl(ostream &)'
cSouse_Input.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x26): undefined reference to `cerr'
cSouse_Input.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x2b): undefined reference to `ostream::operator<<(char const *)'
cSouse_Input.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x36): undefined reference to `ostream::operator<<(ostream
&(*)(ostream &))'
collect2: ld returned 1 exit status


Here's the cSouse_Input Header-File:

//////////////////////////////////////////////////////////////////////////////////////
#ifndef CSOUSE_KEYBOARD_H
#define CSOUSE_KEYBOARD_H

#include <SDL/SDL.h>
#include <list>

using namespace std;

/*****************************************************
struct which holds key information
*****************************************************/
typedef struct sKeyEvent
{
        SDLKey  key;
        int             pressed;
} KeyEvent;

typedef list<KeyEvent> LISTKEYEVENTS;

class cSouse_Input
{
public:
        cSouse_Input();
        ~cSouse_Input();

        static  cSouse_Input*   getInstance();
        static  void                            delInstance();

        void                                            update();
        KeyEvent*                               getkey(SDLKey searchkey);
        int                                             getmousex();
        int                                             getmousey();
        int                                             getmousepressed();
        char*                                   getlastkey();
private:
        void                                            addkey(SDLKey key,int pressed);

        static cSouse_Input             *instance;

        LISTKEYEVENTS                   lKeyEvents;

        int                                             mousex,mousey;
        int                                             mouse_pressed;
        char                                    clastkey[10];
};
#endif

//////////////////////////////////////////////////////////////////////////////////////

Here's also the makefile... I hope someone knows what's getting wrong:

#######################################################################################################
# SOUSE Technology Demo makefile
#######################################################################################################
all: souse

souse:   main.o cSouse_System.o cSouse_TexMan.o cSouse_Input.o
cSouse_Camera.o\
                cSouse_RenderSys.o cSouse_Util.o cSouse_Model.o cSouse_BaseEntity.o\
                cSouse_RenderSys_ModelModul.o GLFont.o cSouse_IDCounter.o
cSouse_ModelEntity.o\
                ImageGL.o Error.o ImageTarga.o Utility.o

                gcc main.o cSouse_System.o cSouse_TexMan.o cSouse_Input.o
cSouse_Camera.o\
                cSouse_RenderSys.o cSouse_Util.o cSouse_Model.o cSouse_BaseEntity.o\
                cSouse_RenderSys_ModelModul.o GLFont.o cSouse_IDCounter.o
cSouse_ModelEntity.o\
                ImageGL.o Error.o ImageTarga.o Utility.o\
                -o ./bin/test -lpthread -lSDL -lSDL_image -lGL -lGLU -L/usr/lib
-L/usr/X11R6/lib

main.o: ./souse/main.cpp
        gcc -c ./souse/main.cpp

#################
#####Systemklasse
cSouse_System.o: ./souse/cSouse_System.h ./souse/cSouse_System.cpp
                                g++ -c ./souse/cSouse_System.cpp

#################
#####TexturManager
cSouse_TexMan.o: ./souse/cSouse_TexMan.h ./souse/cSouse_TexMan.cpp
                                g++ -c ./souse/cSouse_TexMan.cpp

#################
#####Inputklasse
cSouse_Input.o: ./souse/cSouse_Input.h ./souse/cSouse_Input.cpp
                                g++ -c ./souse/cSouse_Input.cpp

#################
#####Kameraklasse
cSouse_Camera.o: ./souse/cSouse_Camera.h ./souse/cSouse_Camera.cpp
                                g++ -c ./souse/cSouse_Camera.cpp

#################
#####RenderSystem
cSouse_RenderSys.o: ./souse/cSouse_RenderSys.h
./souse/cSouse_RenderSys.cpp
                                g++ -c ./souse/cSouse_RenderSys.cpp

#################
#####UtilityKlasse
cSouse_Util.o: ./souse/cSouse_Util.h ./souse/cSouse_Util.cpp
                                g++ -c ./souse/cSouse_Util.cpp

#################
#####ModelKlasse
cSouse_Model.o: ./souse/cSouse_Model.h ./souse/cSouse_Model.cpp
                                g++ -c ./souse/cSouse_Model.cpp

#################
#####BasisEntity
cSouse_BaseEntity.o: ./souse/cSouse_BaseEntity.h
./souse/cSouse_BaseEntity.cpp
                                g++ -c ./souse/cSouse_BaseEntity.cpp

#################
#####RenderSys ModelModul
cSouse_RenderSys_ModelModul.o: ./souse/cSouse_RenderSys_ModelModul.h
./souse/cSouse_RenderSys_ModelModul.cpp
                                g++ -c ./souse/cSouse_RenderSys_ModelModul.cpp

#################
#####GLFont
GLFont.o: ./souse/GLFont.cpp ./souse/GLFont.cpp
                                g++ -c ./souse/GLFont.cpp

#################
#####ID Counter
cSouse_IDCounter.o: ./souse/cSouse_IDCounter.h
./souse/cSouse_IDCounter.cpp
                                g++ -c ./souse/cSouse_IDCounter.cpp

#################
#####ModelEntity
cSouse_ModelEntity.o: ./souse/cSouse_ModelEntity.h
./souse/cSouse_ModelEntity.cpp
                                g++ -c ./souse/cSouse_ModelEntity.cpp

#################
#####ImageGL
ImageGL.o: ./souse/ImageGL.h ./souse/ImageGL.h ./souse/ImageGL.cpp
                                g++ -c ./souse/ImageGL.cpp

#################
#####Error
Error.o: ./souse/Error.h ./souse/Error.h
                                g++ -c ./souse/Error.cpp

#################
#####ImageTarga
ImageTarga.o: ./souse/ImageTarga.h ./souse/ImageTarga.cpp
                                g++ -c ./souse/ImageTarga.cpp

#################
#####Utility
Utility.o: ./souse/Utility.h ./souse/Utility.cpp
                                g++ -c ./souse/Utility.cpp


Sorry for this very long mail but I really need help.

Bye,

-- 
Alexander Bierbrauer

Coder & Coordinator of polyfrag
eMail: alex at polyfrag.com
Web:   http://www.polyfrag.com
---------------------------------
~v^[running Linux Mandrake 8.1]^v~




More information about the SDL mailing list