Page 1 of 1

Unable to compile any example files for IrrNewt.

Posted: Mon Jun 08, 2009 2:53 am
by CheeseKeg
As a last resort, (I should have done this earlier) I am posting here to ask for your helping hand.
I spent hours today trying to work out tons of syntax errors that I was getting for IrrNewt examples. I even had to change some of the scripture in the included files for IrrNewt, but I just plain have no idea what a solution or alternative could be for this last linker error that I've been trying to work out..

I'm using Dev-C++.

The example file I am attempting to compile is ragdoll.cpp. (Though I have this same problem for anything that uses createBody() or createBodyAuto())

------------Here is the related code:----------------
----CODE:--------------------------------------------
---- //INI PHYSICS
---- p_world = irr::newton::createPhysicsWorld(device);
---- ragdoll_material = p_world->createMaterial();
---- world_material = p_world->createMaterial();
---- cube_material = p_world->createMaterial();
----
---- p_world->createBodyAuto(world_node, world_mesh)->setMaterial(world_material);
-------------------------------------------------------

------------Here is the linker error:-----------------
----CODE:--------------------------------------------
---- [Linker error] undefined reference to `_imp___ZN3irr6newton6IWorld14createBodyAutoEPNS_5scene10ISceneNodeEPNS2_5IMeshEfjNS_4core8CMatrix4IfEENS7_8vector3dIfEENS0_18E_CALCULATE_OFFSETENS0_16E_CALCULATE_SIZEE'
---- ld returned 1 exit status
-------------------------------------------------------
I bolded the function name in the linker error to show that they are related.

Here's what I tried:
Compiling with the latest version of Irrlicht as well as Irrlicht v1.2.
Using the createBody() function instead of createBodyAuto() with the same parameters.

If more information is needed to troubleshoot, feel free to request that I give it.

Any help/suggestions would be greatly appreciated!
- CheeseKeg.


By the way, the reason I didn't put the code in code blocks is because I wanted to highlight createBodyAuto in both.

Posted: Mon Jun 08, 2009 12:41 pm
by serengeor
Hmm did you pragma comented the irr newt lib ?
if not
write this :

Code: Select all

#pragma comment(lib, "IrrNewt.lib")

Re: Unable to compile any example files for IrrNewt.

Posted: Mon Jun 08, 2009 1:41 pm
by Malgodur
CheeseKeg wrote: ------------Here is the related code:----------------
----CODE:--------------------------------------------
---- //INI PHYSICS
---- p_world = irr::newton::createPhysicsWorld(device);
---- ragdoll_material = p_world->createMaterial();
---- world_material = p_world->createMaterial();
---- cube_material = p_world->createMaterial();
----
---- p_world->createBodyAuto(world_node, world_mesh)->setMaterial(world_material);
-------------------------------------------------------
------------Heres my hint:--------------------------
----HINT:--------------------------------------------
---- //FOR CheeseKeg
---- you
---- should
---- use
----

Code: Select all

---- instead
---- of
----  ------------------------------- 
---- !!
---- because
---- it
---- keep
---- code
---- readable!
[b]-------------------------------------------------------[/b]

Re: Unable to compile any example files for IrrNewt.

Posted: Mon Jun 08, 2009 1:55 pm
by Sylence
CheeseKeg wrote: By the way, the reason I didn't put the code in code blocks is because I wanted to highlight createBodyAuto in both.

Posted: Mon Jun 08, 2009 2:09 pm
by Acki
serengeor wrote:Hmm did you pragma comented the irr newt lib ?
if not
write this :

Code: Select all

#pragma comment(lib, "IrrNewt.lib")
He's using DevCpp so this pragma will be ignored... ;)
in DevCpp you'll need to add the lib to the linker settings !!!

and as standard advice for DevCpp users: try Code::Blocks instead, it's much better and still supported (DevCpp is not since a long time)... ;)
CheeseKeg wrote: By the way, the reason I didn't put the code in code blocks is because I wanted to highlight createBodyAuto in both.
you mean code tags, for sure... :lol:

Posted: Mon Jun 08, 2009 2:18 pm
by Sylence
Or Visual Studio Express. But that is a matter of personal taste.

Re: Unable to compile any example files for IrrNewt.

Posted: Tue Jun 09, 2009 3:39 am
by CheeseKeg
Malgodur wrote: ------------Heres my hint:--------------------------
----HINT:--------------------------------------------
---- //FOR CheeseKeg
---- you
---- should
---- use
----

Code: Select all

---- instead
---- of
----  ------------------------------- 
---- !!
---- because
---- it
---- keep
---- code
---- readable!
[b]-------------------------------------------------------[/b][/quote]

I see that you definitely had to have read my entire post..
I'm not blind, I can clearly see the CODE BBC, but due to the validity of my highlighting text within the code, and since it's only actually six to eight lines of code total (Only two that need any attention at all), I think you can abide to my post's format.
------

I appreciate the suggestions that everyone else is handing to me.

I am using Dev-C++. (as mentioned in my first post)

Here are the linked libraries:

[code]../../lib/win32-gcc/libIrrNewt.a
../../../Irrlicht/irrlicht-1.5/lib/Win32-gcc/libIrrlicht.a
../../../NewtonSDK/sdk/dll/Newton.lib
I assure you that all of the locations are valid and the libraries do exist in those directories

Posted: Fri Jun 19, 2009 3:19 pm
by RodrigoAmazonas
Hey! I'm getting a similar problem. I've downloaded the ShTlTerrainSceneNode and was trying to compile it. I only had to change a single line

scene::E_DEBUG_SCENE_TYPE dtype = terrain->isDebugDataVisible();

to

scene::E_DEBUG_SCENE_TYPE dtype = scene::E_DEBUG_SCENE_TYPE(terrain->isDebugDataVisible());

I thought typecasting should be automatic, since scene::E_DEBUG_SCENE_TYPE is an ENUM, and terrain->isDebugDataVisible() returns a s32, shouldn't it? But now it keeps telling that

main.cpp||undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverE'|
main.cpp||undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverE'|
main.cpp||undefined reference to `ShTlTerrainSceneNode::ShTlTerrainSceneNode(irr::scene::ISceneManager*, int, int, float, int, irr::scene::ISceneNode*, int)'|
||=== Build finished: 3 errors, 0 warnings ===|

I have unzipped the demo and source to the same folder, and added that folder to the Compiler and Linker search directories. What else should be done? I've got the same error in Dev-C++ and Code::Blocks. I'm using IrrLicht 1.5 under Windows XP.

Thanks in advance!

Posted: Fri Jul 03, 2009 6:57 pm
by RodrigoAmazonas
For the case anyone run into a similar problem:

Project options:
Search directories:
Compiler:
......irrlicht-1.5\include
Linker:
......irrlicht-1.5\lib\Win32-gcc (or anyone you're using)

and
Linker settings:
Link libraries:
......irrlicht-1.5\lib\Win32-gcc\libIrrlicht.a

That's all!