Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: AltarofScience on February 10, 2012, 01:58:47 am

Title: Code::Blocks and PhysX
Post by: AltarofScience 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.
Title: Re: Code::Blocks and PhysX
Post by: Alpha 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:

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? (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_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.3F)
Title: Re: Code::Blocks and PhysX
Post by: AltarofScience 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.
Title: Re: Code::Blocks and PhysX
Post by: Alpha 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 (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 (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).
Title: Re: Code::Blocks and PhysX
Post by: AltarofScience 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.