Author Topic: Code::Blocks and PhysX  (Read 4188 times)

Offline AltarofScience

  • Single posting newcomer
  • *
  • Posts: 3
Code::Blocks and PhysX
« on: February 10, 2012, 01:58:47 am »
I got my license for NVidia's PhysX physics engine but it does not have any tutorials for how to use this with Code::Blocks. It only talks about Visual Studios.
I have included things like GLUT by putting things in file paths and such, but PhysX does not come with any .dll files and GLUT only had like 1 header. PhysX comes with dozens. I googled this topic several times before posting here but no one seems to have an answer.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Code::Blocks and PhysX
« Reply #1 on: February 10, 2012, 02:49:15 am »
As I lack access to this SDK, I cannot give you any specific instructions, however, assuming it is similar to other SDK's, the general setup is as follows:
  • Add the folder with all the *.h (or *.hpp or *.hxx) files (usually some_path\include) to the compiler search directories
  • Add the folder containing lib*.a or *.lib files (usually some_path\lib) to the linker search directories
  • Add the names of the lib*.a or *.lib files you use (or all of them if you do not know which ones exactly) to link libraries

See also: I would like to compile a project using some non-standard libraries. How can I indicate to CodeBlocks that these libraries and include files exist?

Offline AltarofScience

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code::Blocks and PhysX
« Reply #2 on: February 10, 2012, 03:52:03 am »
compiler search directories? i dont know what that means.
i have:
Code Blocks/MinGW
Code Blocks/MinGW/GL
Code Blocks/MinGW /include
Code Blocks/MinGW/lib

There are several folders with headers. Should I put any folder with header files into the same place?
Some have headers and C++ source files.

The PhysX folders are:
PhysXAPI
PhysXCharacterKinematic
PhysXCommon
PhysXExtensions
PhysXMetaData
PhysXProfileSDK
PhysXVehicle
PhysXVisualDebuggerSDK
PMB Files
PvdRuntime
PXFoundation
PxTask
RepX
RepXUpgrader

Some of them contain their own folders or headers or C++ source files or both.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Code::Blocks and PhysX
« Reply #3 on: February 10, 2012, 05:16:41 am »
compiler search directories? i dont know what that means.
Sorry; I should have clarified: Project->Build options...->Search directories (tab)

There are several folders with headers. Should I put any folder with header files into the same place?
One should never move the files of an SDK (unless, of course, they are themselves writing the SDK - not using it).  What I had been referring to was adding the location(s) of the headers to Project->Build options...->Search directories (tab)->Compiler (tab).  From the names of the folders, I would guess the one you need might be PhysXAPI.  To determine this definitively, open up a PhysX sample project (which I assume they included), and look for an #included file; then find the physical location of this file within the SDK.  The other (better) option would be to ask someone on a NVIDIA forum which folder contains the SDK's headers.

Using Windows Explorer, search the PhysX SDK for *.lib and *.a - there should be a directory containing several of these (although, likely of only one, not both, extension).  Add this directory to Project->Build options...->Search directories (tab)->Linker (tab).  Also, add the names of these files to Project->Build options...->Linker settings (tab)->Link libraries.

After these steps, Code::Blocks should be able to compile any sample PhysX code you were provided with (working under the assumption that PhysX is compatible with GCC/MinGW).

Edit: after a bit of searching, I came up with http://mmmovania.blogspot.com/2011/05/getting-started-with-physx-3.html and http://about.something.pl/art/getting-started-with-physx-sdk-3-0-on-linux.html.  You should try following these instructions to see if they can be applied to Code::Blocks + MinGW.  Be warned, however, that I also saw several mentions saying MinGW was incompatible - you may be forced to install the Microsoft compiler (although you can still use Code::Blocks to run it).

Offline AltarofScience

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code::Blocks and PhysX
« Reply #4 on: February 10, 2012, 05:49:48 am »
It turns out I lose some files but I still have a few issues. For one, NVidia seems to have a hardon for microsoft and visual studios. For another it doesn't support 64bit architecture. That is pretty easy to solve though. I will work through those tutorials and see what I can get done. Thanks.