0

i using code::blocks and irrlicht but when i run my code i get a list of errors i don't know why my code are right and i use the version 1.8.3 from the lib and i definded it in the code::blocks options

||=== Build: Debug in shit2 (compiler: GNU GCC Compiler) ===| ../../irrlicht-1.8.3/source/Irrlicht/libIrrlicht.a(CIrrDeviceLinux.o)||In function irr::CIrrDeviceLinux::~CIrrDeviceLinux()':| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|138|undefined reference toXFree'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|170|undefined reference to glXMakeContextCurrent'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|175|undefined reference toglXMakeCurrent'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|178|undefined reference to glXDestroyContext'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|180|undefined reference toglXDestroyWindow'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|192|undefined reference to XDestroyWindow'| /home/shar/irrlicht-1.8.3/source/Irrlicht/CIrrDeviceLinux.cpp|193|undefined reference toXCloseDisplay'|

that's my code

#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace video;

int main()
{
    IrrlichtDevice* device = createDevice(EDT_OPENGL);
    if(!device) return 1;
    IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();
    gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
    guienv->addStaticText(L"hello shit", recti(10, 10, 100, 30));
    while(device->run())
    {

        driver->beginScene(true, true, SColor(255, 190, 190, 250));
        smgr->drawAll();
        guienv->drawAll();
        driver->endScene();

    }
    device->drop();
}
  • Did you pass `-lIrrlicht` to the linker? Assuming you are on Linux. – nwp Mar 17 '16 at 16:31
  • yes and that's still give me the error – Mohamed Elsharkawey Mar 17 '16 at 18:25
  • Your code works when I link with `-lIrrlicht`. Whatever the problem, it is not in the code you show. Could it be that the headers you use are from a different version than the linked library? – nwp Mar 17 '16 at 18:39
  • im version 1.8.3 and i follow tutorial that 1.7 are that make a diffrent ? – Mohamed Elsharkawey Mar 17 '16 at 18:43
  • That will probably be a problem in the future, but not yet. Your code works in 1.8.3. But your paths look like you have irrlicht installed through a package manager (maybe version 1.7) and also downloaded and used the headers for 1.8.3 and then the versions don't match. Could that be it? – nwp Mar 17 '16 at 18:59
  • Those are X11 functions. It probably wants to be linked with an X11 library. – wallabra Sep 06 '20 at 04:04

0 Answers0