IrrPhysx 0.2 - Nvidia Physx 2.8.1 wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Lambda
Posts: 126
Joined: Wed Feb 27, 2008 3:00 pm
Location: Spain, Huelva
Contact:

Post by Lambda »

Pie21 wrote: Oh! And for the record, the game example crashes before it loads - someone else mentioned the same problem earlier in this thread. Loads up all the meshes and textures then just hits a wall, although I don't think that's at all related.
Same here.

PD: Visual Studio => 2005 sucks, when i compile any of my projects with 2008 or 2005 i get random crashes on WTF places.
Image
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

i tried to start the example after installing all those necessary files, and it crashed, i captured a screen for you:
Image
i love skateboarding!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Pie21, Looks like you're not linking to Irrlicht? You need to add the include files and lib of irrlicht ;)

I really don't know what would be going wrong with the game example... It's never crashed like that for me I don't think so it's pretty hard to try and debug it or anything.. :s
Image Image Image
Pie21
Posts: 13
Joined: Mon Oct 06, 2008 11:21 am
Location: Melbourne, Australia
Contact:

Post by Pie21 »

JP himself! :D

Okay, you were partly right. Mentioning that perhaps I hadn't included Irrlicht made me remember the #pragma comment(lib, "Irrlicht.lib") that shows up in the tutorials, so I added that and it cuts out the third error. Now I'm left with the first two, which are clearly something to do with IPhysxManager (creating and removing):
1>Tango.obj : error LNK2019: unresolved external symbol "void __cdecl IrrPhysx::removePhysxManager(class IrrPhysx::IPhysxManager *)" (?removePhysxManager@IrrPhysx@@YAXPAVIPhysxManager@1@@Z) referenced in function _main
1>Tango.obj : error LNK2019: unresolved external symbol "class IrrPhysx::IPhysxManager * __cdecl IrrPhysx::createPhysxManager(class irr::IrrlichtDevice *,struct IrrPhysx::SSceneDesc const &,bool)" (?createPhysxManager@IrrPhysx@@YAPAVIPhysxManager@1@PAVIrrlichtDevice@irr@@ABUSSceneDesc@1@_N@Z) referenced in function _main
There's a file called IPhysxManager in the irrPhysx include folder (which I've included) - maybe it's not catching somehow? These are my Include and Library directories in MSVC for the record.

Image
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You just need to include IrrPhysx.h and then add using namespace IrrPhysx or do IrrPhysx::createPhysxManager() etc, just like in irrlicht, that could be the problem here.

You don't have to include any files from IrrPhysx apart from IrrPhysx.h :)
Image Image Image
Pie21
Posts: 13
Joined: Mon Oct 06, 2008 11:21 am
Location: Melbourne, Australia
Contact:

Post by Pie21 »

Mkay, well I removed the top 4 directories from that include list (too many couldn't hurt though, right?), and the top of the main source file is exactly the same as the example (including #include <IrrPhysx.h>) plus:

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

Interestingly, if I try and run it on my laptop it gives exactly the same error, and I don't even have the PhysX SDK installed. I can't compile the VC Project file of the BoxesExample either - that throws even more errors, but with the same two at the end.

The thing is it compiles alright but refuses to link properly. It's only those 2 symbols, and while my knowledge of what a symbol is comes only from Google, both the functions it's having trouble with are in IrrPhysx.h. It's included fine, because it throws ambiguous overload errors if I copy the declarations into the main .cpp. LNK2019 is a stupid bloody error because it seems to have well over 9000 different possible causes. A number of Google'd answers involve adding a .dll to the Project Properties -> Linker -> Input -> Additional Dependencies. Could that mean anything in this case? Adding IrrPhysx.dll just seems to break it more.

I thought maybe there was a problem getting at IrrPhysx.cpp, and that maybe the definitions (or lack of) of those functions was screwing things up. To my surprise, I could delete IrrPhysx.cpp (in \SRC) and the build log would be identical - it still compiles properly. That makes no sense to me, but then you could say that about plenty of things.

Incidentally, the GameExample bombs out the same on my laptop (XP x86, same everything else). I hate this because I know the answer is going to be something simple, and when we figure it out everyone will be like "OH why didn't you do that in the FIRST PLACE???" :( Question: can anyone else who's having trouble with GameExample.exe rebuild the examples successfully?
AK47
Posts: 1
Joined: Fri Dec 12, 2008 4:21 pm

Same problem :-(

Post by AK47 »

Hello people,
im new here.. have been using Irrlicht recently n i think i can use it properly now..

The problem is that while using IrrPhysx im getting the same linker errors

Code: Select all

1>RigidBody2.obj : error LNK2019: unresolved external symbol "void __cdecl IrrPhysx::removePhysxManager(class IrrPhysx::IPhysxManager *)" (?removePhysxManager@IrrPhysx@@YAXPAVIPhysxManager@1@@Z) referenced in function _main
1>RigidBody2.obj : error LNK2019: unresolved external symbol "class IrrPhysx::IPhysxManager * __cdecl IrrPhysx::createPhysxManager(class irr::IrrlichtDevice *,struct IrrPhysx::SSceneDesc const &,bool)" (?createPhysxManager@IrrPhysx@@YAPAVIPhysxManager@1@PAVIrrlichtDevice@irr@@ABUSSceneDesc@1@_N@Z) referenced in function _main


EDIT:
OOPSSSS...


It actually was a n00b problem.!!


I had included the Lib folder of IrrPhysx in the directories option in Tools->Options
But i did not put the names of the Libs in the dependencies section of the project.

For all those who are getting this error, you need to specify 3 libs
Simply write in ur source file

Code: Select all

#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "IrrPhysx.lib")
#pragma comment(lib, "PhysXLoader.lib")
That should do it.
IrrNoob
Posts: 110
Joined: Sun Nov 16, 2008 8:01 pm
Location: Fort Collins, Us

Post by IrrNoob »

JP, when will IrrPhysx be able to compile in dev-cpp? Thats the compiler I use.
maroxe
Posts: 51
Joined: Wed Dec 10, 2008 1:52 pm

Post by maroxe »

does it support car simulation?
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

JP, when will IrrPhysx be able to compile in dev-cpp? Thats the compiler I use.
The problem is with PhysX, not JP's wrapper for it. If you want PhysX to work with MinGW (or anything other than MSVC for that matter), go bug Nvidia about it, since the problem is with PhysX itself.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
Pie21
Posts: 13
Joined: Mon Oct 06, 2008 11:21 am
Location: Melbourne, Australia
Contact:

Re: Same problem :-(

Post by Pie21 »

AK47 wrote:Hello people,
im new here.. have been using Irrlicht recently n i think i can use it properly now..

The problem is that while using IrrPhysx im getting the same linker errors
Exactly same boat for me :(

I tried including those 3 pragmas, but then I get this:
1>IrrPhysx.lib(IrrPhysx.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : fatal error LNK1104: cannot open file 'PhysXLoader.lib'
The last line is the only one I can even vaguely comprehend. I've got C:\Program Files (x86)\NVIDIA Corporation\NVIDIA PhysX SDK\v2.8.1\SDKs\lib\Win32 in my Library Directories, but that doesn't seem to help. I get a feeling it the previous 2 lines that are screwing with it...
It actually was a n00b problem.!!
Isn't it always ;)
IrrNoob
Posts: 110
Joined: Sun Nov 16, 2008 8:01 pm
Location: Fort Collins, Us

Post by IrrNoob »

The problem is with PhysX, not JP's wrapper for it. If you want PhysX to work with MinGW (or anything other than MSVC for that matter), go bug Nvidia about it, since the problem is with PhysX itself.
Thanks :)

UPDATE:
on second thought, setting up MSVC for Irrlicht is hard enough, I can't see getting JP's wrapper to work in MSVC 2008, but I would love to know how.
Carama
Posts: 10
Joined: Sun Dec 14, 2008 12:44 pm

Post by Carama »

Image

Hello, i have the same problem as psychophoniac.

I tried to find the bug and it is the terrain :shock: .

My working around was:

Code: Select all

//physxManager->createHeightfieldObject((scene::ITerrainSceneNode*)node, 0);
Now the Game is running but without collision with the terrain :roll: .
Can anybody help me?

Important things from the console:

Code: Select all

Irrlicht Engine version 1.4.2
Microsoft Windows Vista Personal Service Pack 1 (Build 6001)
Using renderer: Direct3D 9.0
NVIDIA GeForce 8400M GS  nvd3dum.dll 7.15.11.5669
IrrPhysx wrapper version 0.20 for Physx by Nvidia 2.8.1
f:\scmvista\experimental\PhysX_2.8.1_GPU\novodex\SDKs\Core\Device\RegistryHardwareSelection.cpp (71) :warning : CUDA not available
f:\scmvista\experimental\PhysX_2.8.1_GPU\novodex\SDKs\Core\Device\RegistryHardwareSelection.cpp (71) :warning : CUDA not available
PhysX accelerator hardware not found, simulation will be done in software
PS: I use Visual Studio 2008. I just recompiled IrrPhysX.
Pie21
Posts: 13
Joined: Mon Oct 06, 2008 11:21 am
Location: Melbourne, Australia
Contact:

Post by Pie21 »

Update on my current predicament - it's working!

Although getting it to work felt very scrappy. First of all, AK47's extra #pragma comments DID fix those external symbol errors, but I was still getting that mysterious "cannot open file 'PhysXLoader.lib', despite the folder it was in definitely being pointed at in the Directories thing. To find it, I just changed:

Code: Select all

#pragma comment(lib, "PhysXLoader.lib")
to:

Code: Select all

#pragma comment(lib, "C:\\Program Files (x86)\\NVIDIA Corporation\\NVIDIA PhysX SDK\\v2.8.1\\SDKs\\lib\\Win32\\PhysXLoader.lib")
So then it managed to find the .lib. Finally! However it then threw some LNK2005 errors, which some Google-ingrevealed meant there was an inconsistency between some setting of the ".lib and .dll projects"? Whatever, I changed Project Properties -> C/C++ -> Code Generation -> Runtime Library from /MDd to /MTd, and that got rid of those errors.

It then compiled with 4 linking warnings:

Code: Select all

1>Linking...
1>IrrPhysx.lib(IrrPhysx.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
1>Embedding manifest...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>IrrPhysx.lib(IrrPhysx.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
I couldn't understand them, but I wasn't too worried because it worked! The application then bombed almost immediately, but the console output informed me that it couldn't find certain files in "../media/", so I copied the media folder from IrrPhysx/examples to my project's folder and changed the paths in the code (my main.cpp, anyway) to just "media/", and it then worked perfectly!

(I just noticed, from fiddling with the examples, all the textures for the blocks is still looking at "../media/", so the media folder needed to be copied there too. I guess that path assumes your EXE ends up in a /bin/ folder?).

I don't know whether any of this is good/bad/expected, but does anyone know what those warnings mean?

I tried taking similar steps to build the BoxesExample example, which seemed like everything magically knew where everything else was on JP's PC, but those magic pointers had disappeared - I had to add about 4 more Include Directories than my other project, and copy the media folder from the IrrPhysx root to the IrrPhysx/examples/ folder.

Hopefully this is of some use to someone. Stuff works to an extent now! Oh, and having worked with all this stuff for a few days now trying to work out what and what not to add, I've got a glimpse of just how much stuff there is in IrrPhysx, and I've gotta say awesome job, JP!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well done Pie21! Glad you managed to sort it out, I must say that I was a bit lost with how to help you! Sorting out compiler settings can be rather tricky... I did mess around with the compiler settings in the IrrPhysx project a fair bit, mainly to not rely on the MSVC runtime libraries so that people without those installed could run the demos and I think that's where a lot of the problems have lied. Hopefully your posts here should help anyone else with similar problems!

I wouldn't worry about your warnings... I used Link Time Code Generation in the IrrPhysx compiler settings so if you don't have that applied in your compiler settings then it will flag up some warnings and change at link time but it looks like it's not had any actual problems, it's just telling you that it's making changes to your linker setup.

Carama, thanks very much for diagnosing that GameExample problem! At least a little bit anyway! Now I know what line of code is crashing on (at least on your system) so I can start guessing what's going wrong...

IrrNoob, IrrPhysx is compiled with MSVC 08 already and the project files are provided so you shouldn't have any work to do there...

maroxe, IrrPhysx doesn't support any car simulation right now and to be honest I don't think it'll be supported any time soon...
Image Image Image
Post Reply