After downloading the latest Irrlicht version (1.8.4) and setting it to compile for Linux machines, I decided to try it out in Code::Blocks IDE. The build failed.
-------------- Build: Debug in Demo (compiler: GNU GCC Compiler)---------------
g++ -Wall -g -I/home/marino/irrlicht-1.8.4/include -c /home/marino/Codeblock/Irrlicht/Chrono/Demo/main.cpp -o obj/Debug/main.o
/home/marino/Codeblock/Irrlicht/Chrono/Demo/main.cpp: In function ‘int main(int, char**)’:
/home/marino/Codeblock/Irrlicht/Chrono/Demo/main.cpp:70:36: error: invalid initialization of reference of type ‘const irr::core::dimension2d<unsigned int>&’ from expression of type ‘irr::core::dimension2d<int>’
createDevice(EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/marino/Codeblock/Irrlicht/Chrono/Demo/main.cpp:10:0:
/home/marino/irrlicht-1.8.4/include/irrlicht.h:324:54: note: in passing argument 2 of ‘irr::IrrlichtDevice* irr::createDevice(irr::video::E_DRIVER_TYPE, const irr::core::dimension2d<unsigned int>&, irr::u32, bool, bool, bool, irr::IEventReceiver*)’
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(
^~~~~~~~~~~~
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
This is the line #70 of main.cpp file.
/*
The most important function of the engine is the 'createDevice'
function. The Irrlicht Device can be created with it, which is the
root object for doing everything with the engine.
createDevice() has 7 paramters:
deviceType: Type of the device. This can currently be the Null-device,
the Software device, DirectX8, DirectX9, or OpenGL. In this example we use
EDT_SOFTWARE, but to try out, you might want to change it to
EDT_NULL, EDT_DIRECTX8 , EDT_DIRECTX9, or EDT_OPENGL.
windowSize: Size of the Window or FullscreenMode to be created. In this
example we use 640x480.
bits: Amount of bits per pixel when in fullscreen mode. This should
be 16 or 32. This parameter is ignored when running in windowed mode.
fullscreen: Specifies if we want the device to run in fullscreen mode
or not.
stencilbuffer: Specifies if we want to use the stencil buffer for drawing shadows.
vsync: Specifies if we want to have vsync enabled, this is only useful in fullscreen
mode.
eventReceiver: An object to receive events. We do not want to use this
parameter here, and set it to 0.
*/
IrrlichtDevice *device =
createDevice(EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
PC Specifications
- Linux Mint 19.3 Cinnamon 4.4.8
- Intel© Pentium© 3558U @ 1.70GHz × 2
- 3.8 GiB
- Intel Corporation Haswell-ULT Integrated Graphics Controller
What could be the problem?
const irr::core::dimension2d<unsigned int>&’ from expression of type ‘irr::core::dimension2d<int>’
. It expects anunsigned int
, but gets anint
. \$\endgroup\$