PhysX SDK version 2.8.1 Problem initializing Lesson101

Hello everyone , I’m new using the PhysX SDK and I decided to start with version 2.8.1 since it seems that brings complete information on how to use this engine.

I started by Lesson101 and am following the trainningProgram / ​​documents . I set my " Ide " with the necessary patch and added two files to my project the " Lesson101.h " and an empty file " Lesson101.cpp "

The problem is this is not why it happens :

When I start to fill in code in the tutorial shows that by adding this code to cpp file and compile the program :

CODE :

include " Lesson101.h "

include " UpdateTime.h "

/ / Physics SDK globals
NxPhysicsSDK * gPhysicsSDK = NULL ;
NxScene * gScene = NULL ;
NxVec3 gDefaultGravity (0, -9.8,0 ) ;

void InitNx()
{
/ / Create the physics SDK
gPhysicsSDK = NxCreatePhysicsSDK ( NX_PHYSICS_SDK_VERSION ) ;
if (! gPhysicsSDK ) return;

/ / Create the scene
NxSceneDesc sceneDesc ;
sceneDesc.gravity = gDefaultGravity ;

gScene = gPhysicsSDK -> createScene ( sceneDesc ) ;

}

void main ( int argc, char ** argv )
{
InitNx ();
}

/////////////////////////////////////////////////////////////
These are the compilation errors that I get: (See post below)
/////////////////////////////////////////////////////////////

I tried several things, but not why gPhysicsSDK variables that are declared globally, not detected within the initNx function () and the variable “sceneDesc” created within InitNx () also gives compilation errors to do sceneDesc.gravity = gDefaultGravity;

Besides errors “MessageBoxW” also not why it happens.

Someone could help me?? I hope your answer, greetings and thanks.

But it gives me compile error :

1 > Lesson101.cpp

1 > c : \ program files (x86 ) \ nvidia corporation \ nvidia physx sdk \ v2.8.1 \ trainingprograms \ programs \ shared_source \ user_reports \ errorstream.h ( 43 ): error C2664 : ’ MessageBoxW ’ : can not convert parameter 2 'const char * ’ to ’ LPCWSTR ’
1 > Types pointed to are not related , the conversion requires reinterpret_cast , C- style cast or function -style cast
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.h ( 63 ): error C3872 : '0 xa0 ’ : this character is not allowed in an identifier
1 > c : \ program files (x86 ) \ nvidia corporation \ nvidia physx sdk \ v2.8.1 \ trainingprograms \ programs \ shared_source \ timer \ updatetime.h ( 54 ): error C2144 : syntax error : 'float ’ should be preceded of ’ ; ’
1 > c : \ program files (x86 ) \ nvidia corporation \ nvidia physx sdk \ v2.8.1 \ trainingprograms \ programs \ shared_source \ timer \ updatetime.h ( 54 ): error C4430 : missing type specifier int assumed . Note : C + + does not support default- int
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp (10 ): error C3872 : '0 xa0 ’ : this character is not allowed in an identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp (11 ): error C2144 : syntax error : ‘void ’ should be preceded by ’ ; ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp (11 ): error C4430 : missing type specifier int assumed . Note : C + + does not support default- int
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp (11 ): error C2086 : ‘int ’ : redefinition
1 > c : \ program files (x86 ) \ nvidia corporation \ nvidia physx sdk \ v2.8.1 \ trainingprograms \ programs \ shared_source \ timer \ updatetime.h ( 54 ) : see declaration of ’ ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 16 ): error C3872 : ‘0 xa0 ’ : this character is not allowed in an identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 18 ): error C2146 : syntax error : missing ’ , ’ before identifier ’ NxSceneDesc ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 18 ): error C2146 : syntax error : missing ’ , ’ before identifier ’ sceneDesc ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 18 ): error C2275 : ’ NxSceneDesc ’ : Invalid use of this type as an expression
1 > c : \ program files (x86 ) \ nvidia corporation \ nvidia physx sdk \ v2.8.1 \ sdks \ physics \ include \ nxscenedesc.h ( 368): see declaration of ’ NxSceneDesc ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 18 ): error C2065 : ’ sceneDesc ’ : undeclared identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 19 ): error C2065 : ’ sceneDesc ’ : undeclared identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 19 ): error C2228 : left operand . ’ Gravity’ must have class / struct / union
1 > type is ‘’ unknown- type’’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 20 ): error C3872 : '0 xa0 ’ : this character is not allowed in an identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 21 ): error C2146 : syntax error : missing ’ , ’ before identifier ’ gScene ’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 21 ): error C2065 : ’ sceneDesc ’ : undeclared identifier
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 26 ): error C2556 : 'void main ( int , char ** ) ’ : overloaded function only Unlike 'int main ( int , char ** ) ’ by return type
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.h ( 63 ) : see declaration of ‘main’
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.cpp ( 26 ): error C2371 : ‘main’ : redefinition; different basic types
1 > c: \ users \ guizmito \ documents \ visual studio 2010 \ projects \ physx \ lesson101_primary_shape \ source \ lesson101.h ( 63 ) : see declaration of ‘main’
========== Build : 0 succeeded , 1 failed , 0 upgraded , 0 skipped ==========

I would actually suggest going for PhysX 3, both the documentation and code is far superior and easier to understand.

For the errors, it seems like your linker is setup wrong. Have an extra look to see that you link to the needed .lib’s and the correct ones(debug/release).

Hope it helps.

Hello and thanks for answering .
Well the reason for starting with version 2.8.1 is because I found more documentation to learn how to handle PhysX SDK versions 3 . In which to understand many things and to use it you have to be familiar with previous versions .

Furthermore, errors are not depart I linker , but compiler. Besides I have reviewed the patch of my projects and for the includes and libs are all well .

But I tell you that the project does not start linker, because out compilation errors .

Moreover, if you notice the variable " NxPhysicsSDK :: * gPhysicsSDK " is declared globally and yet within InitNX function ( ) does not detect .
Also the variable " NxSceneDesc :: sceneDesc " is declared in function InitNx ( ) and use it in " sceneDesc.gravity = gDefaultGravity ; " also gives me compilation error.

Someone can help me please? appreciate it very much.

I hope your answer, greetings .

I think Feroza was trying to say was he can’t help you unless you’re using the SDK version 3. Which probably goes for most of the people on the forum.

Since most people here can help you on version 3 it’s a good idea to switch.

Hi,

nice to see that you want to use PhysX.

Its maybe a better way to learn PhysX 3.3 - or Physx 3.x when you are new,
because someday, Nvidia will drop the support of PhsyX 2.x.

Also PhysX 3.x is faster and have nice new features (but the missing clothes, forcefileds…etc)

The PhysX samples are a little bit overloaded for learning I think, but I guess it was in 3.3
they added simple samples which doesnt have a framework around it, so this is the right way to learn it I guess. You should take a look at these, I guess.

UPDATE:

Ups I didnt saw that others replied to :D

Thanks for answering …

Well, what you say may be better to start learning PhysX 3.x.
Could you advise me where to start? or how do tutorials and examples?

I initially tried to learn PhysXSDK 3.x, and trying to follow the guide that brings, I realized that the guide did many things for granted because it is assumed that I have to have experience with previous versions of PhysX SDK.
It’s in the guide itself PhysX SDK 3.x first thing you say is something like that you should have experience with previous versions of PhysX or something.

Could you recommend me to start learning tutorials for versions 3.x SDK???

I hope your answer, greetings and thanks.

Hi,

okay first I started with 2.x years ago, and tryed other physics engines, but PhysX was the well
designed engine for me. So I did some of the tutorials, read the PhysX guide an coded much to learn
how things work.

For newbies like you, I guess its better to learn the “new standart” PhysX 3.x.
The first you should read is the PhysX Guide I think, it has code samples in it and explains a lot to
understand how the engine works and what you should do for the hello world example or something else.
You cant see the PhysX Guide as a tutorial, is more a explain how to use this engine.
Okay, they are picked with some code samples, but I guess the goal of this guide is to show you the
basic concepts how PhysX works.

When you are ready to learn more, you should look into the “Samples” oder “Snippet” folder and look into the files. (HelloWorld would be a good way to go…)

The samples using their framework which is a little bit overloaded for the start of learning I think.
After you learned how you create a PxScene, you could play around with PxShape and PxActor creation (e.g. create a stack of boxes). After that, when you learned it, you could look into other examples
(in the “Samples” folder" ) for further learning.

Again: I would recommend PhysX 3.x due to the fact that NVIDIA is going to release new features
(only) to the PhysX 3.x SDK I guess, the older versions are only getting bug fixes.