headache, help please! How to use PhsyxSdk 3.3.0 with VS2010

I’ve downloaded this : PhysX-3.3.0_PC_SDK_Core.
And I want to run a test code here:

#include <stdio.h>
#include <iostream>
#include <vector>
#include <GL/glut.h>

#include <PxPhysicsAPI.h>
#include <extensions/PxExtensionsAPI.h>
#include <extensions/PxDefaultErrorCallback.h>
#include <extensions/PxDefaultAllocator.h>
#include <extensions/PxDefaultSimulationFilterShader.h>
#include <extensions/PxDefaultCpuDispatcher.h>
#include <extensions/PxShapeExt.h>
#include <extensions/PxSimpleFactory.h>

#include <PxSimulationEventCallback.h>

#include <foundation/PxFoundation.h>

#pragma comment(lib, "PhysX3_x64.lib")
#pragma comment(lib, "PhysX3Common_x64.lib")
#pragma comment(lib, "PhysX3Extensions.lib")
#pragma comment(lib, "PxTask.lib")
//PhysX3_x64.lib;PhysX3Common_x64.lib;PhysX3Extensions.lib;PxTask.lib;

using namespace physx;
using namespace std;

static PxPhysics* gPhysicsSDK = NULL;
static PxDefaultErrorCallback gDefaultErrorCallback;
static PxDefaultAllocator gDefaultAllocatorCallback;
static PxSimulationFilterShader gDefaultFilterShader=PxDefaultSimulationFilterShader;

int startTime = 0, totalFrames = 0;
float fps = 0;
const int WINDOW_WIDTH = 800, WINDOW_HEIGHT = 600;

PxScene* gScene = NULL;
PxReal myTimestep = 1.0f/60.0f;

void StepPhysX()
{
	gScene->simulate(myTimestep);

	while(!gScene->fetchResults() )
	{
		// do something useful
	}
}

void InitializePhysX()
{
	PxFoundation* foundation = PxCreateFoundation(PX_PHYSICS_VERSION, gDefaultAllocatorCallback, gDefaultErrorCallback);

	gPhysicsSDK = PxCreatePhysics(PX_PHYSICS_VERSION, *foundation, PxTolerancesScale() );

	PxInitExtensions(*gPhysicsSDK);

	// Create the scene
	PxSceneDesc sceneDesc(gPhysicsSDK->getTolerancesScale());
	sceneDesc.gravity = PxVec3(0.0f, -9.8f, 0.0f);

	if(!sceneDesc.cpuDispatcher)
	{
		PxDefaultCpuDispatcher* mCpuDispatcher = PxDefaultCpuDispatcherCreate(1);
		sceneDesc.cpuDispatcher = mCpuDispatcher;
	}

	if(!sceneDesc.filterShader)
		sceneDesc.filterShader  = gDefaultFilterShader;

	gScene = gPhysicsSDK->createScene(sceneDesc);

}

void ShutdownPhysX()
{
	gScene->release();
	gPhysicsSDK->release();
}

void OnShutdown()
{
	ShutdownPhysX();
}

void OnRender()
{
	totalFrames++;
	int current = glutGet(GLUT_ELAPSED_TIME);
	if((current-startTime)>1000)
	{
		float elapsedTime = float(current-startTime);
		fps = ((totalFrames * 1000.0f)/ elapsedTime);
		startTime = current;
		totalFrames = 0;
	}

	if (gScene)
		StepPhysX();

	glClearColor(0.1, 0.1, 0.1, 1.0);
	glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	glutSwapBuffers();

}

void OnIdle()
{
	glutPostRedisplay();
}

void main(int argc, char** argv)
{
	atexit(OnShutdown);
	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
	glutCreateWindow("Initialization");

	glutDisplayFunc(OnRender);
	glutIdleFunc(OnIdle);

	InitializePhysX();

	glEnable(GL_DEPTH_TEST);
	glDepthMask(GL_TRUE);
	glutMainLoop();
}

But errors show up:

>main.obj : error LNK2001: 无法解析的外部符号 "class physx::PxFlags<enum physx::PxFilterFlag::Enum,unsigned short> __cdecl physx::PxDefaultSimulationFilterShader(unsigned int,struct physx::PxFilterData,unsigned int,struct physx::PxFilterData,class physx::PxFlags<enum physx::PxPairFlag::Enum,unsigned short> &,void const *,unsigned int)" (?PxDefaultSimulationFilterShader@physx@@YA?AV?$PxFlags@W4Enum@PxFilterFlag@physx@@G@1@IUPxFilterData@1@I0AAV?$PxFlags@W4Enum@PxPairFlag@physx@@G@1@PBXI@Z)
1>main.obj : error LNK2019: 无法解析的外部符号 "class physx::PxDefaultCpuDispatcher * __cdecl physx::PxDefaultCpuDispatcherCreate(unsigned int,unsigned int *)" (?PxDefaultCpuDispatcherCreate@physx@@YAPAVPxDefaultCpuDispatcher@1@IPAI@Z),该符号在函数 "void __cdecl InitializePhysX(void)" (?InitializePhysX@@YAXXZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _PxInitExtensions,该符号在函数 "void __cdecl InitializePhysX(void)" (?InitializePhysX@@YAXXZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxCreateFoundation,该符号在函数 "void __cdecl InitializePhysX(void)" (?InitializePhysX@@YAXXZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxRegisterParticles,该符号在函数 "class physx::PxPhysics * __cdecl PxCreatePhysics(unsigned int,class physx::PxFoundation &,class physx::PxTolerancesScale const &,bool,class physx::PxProfileZoneManager *)" (?PxCreatePhysics@@YAPAVPxPhysics@physx@@IAAVPxFoundation@2@ABVPxTolerancesScale@2@_NPAVPxProfileZoneManager@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxRegisterCloth,该符号在函数 "class physx::PxPhysics * __cdecl PxCreatePhysics(unsigned int,class physx::PxFoundation &,class physx::PxTolerancesScale const &,bool,class physx::PxProfileZoneManager *)" (?PxCreatePhysics@@YAPAVPxPhysics@physx@@IAAVPxFoundation@2@ABVPxTolerancesScale@2@_NPAVPxProfileZoneManager@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxRegisterHeightFields,该符号在函数 "class physx::PxPhysics * __cdecl PxCreatePhysics(unsigned int,class physx::PxFoundation &,class physx::PxTolerancesScale const &,bool,class physx::PxProfileZoneManager *)" (?PxCreatePhysics@@YAPAVPxPhysics@physx@@IAAVPxFoundation@2@ABVPxTolerancesScale@2@_NPAVPxProfileZoneManager@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxRegisterArticulations,该符号在函数 "class physx::PxPhysics * __cdecl PxCreatePhysics(unsigned int,class physx::PxFoundation &,class physx::PxTolerancesScale const &,bool,class physx::PxProfileZoneManager *)" (?PxCreatePhysics@@YAPAVPxPhysics@physx@@IAAVPxFoundation@2@ABVPxTolerancesScale@2@_NPAVPxProfileZoneManager@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 __imp__PxCreateBasePhysics,该符号在函数 "class physx::PxPhysics * __cdecl PxCreatePhysics(unsigned int,class physx::PxFoundation &,class physx::PxTolerancesScale const &,bool,class physx::PxProfileZoneManager *)" (?PxCreatePhysics@@YAPAVPxPhysics@physx@@IAAVPxFoundation@2@ABVPxTolerancesScale@2@_NPAVPxProfileZoneManager@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall physx::PxDefaultErrorCallback::PxDefaultErrorCallback(void)" (??0PxDefaultErrorCallback@physx@@QAE@XZ),该符号在函数 "void __cdecl `dynamic initializer for 'gDefaultErrorCallback''(void)" (??__EgDefaultErrorCallback@@YAXXZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "public: virtual __thiscall physx::PxDefaultErrorCallback::~PxDefaultErrorCallback(void)" (??1PxDefaultErrorCallback@physx@@UAE@XZ),该符号在函数 "void __cdecl `dynamic atexit destructor for 'gDefaultErrorCallback''(void)" (??__FgDefaultErrorCallback@@YAXXZ) 中被引用
1>H:\重要项目\asus\Documents\Visual Studio 2010\PhsyxTest\Debug\PhsyxTest.exe : fatal error LNK1120: 11 个无法解析的外部命令

And I set the directories like this:

But I make it a little difference : “win32” here is replaced by “win64”

please help me, thanks in advance!

Hi,

first, it would be incredible helpful when you translate the error message into english.
Second, when you are using PhysX 3.3, why are you using directories of PhysX 3.21 ?

Also, please try to link against the x86 libs when you try to compile a 32bit application.
Mixing 64bit libs with a 32bit compilation wont work, vice versa.

Other hint:
void StepPhysX() - there is no proper simulation step. Just dig in my profile, I wrote often
how to use a semifixed time step, and why you MUST use it if you really want to use PhysX for more than test applications.

Common hint:

Please recode your test application, your code shows that you doesnt have much skills in coding.

I set every thing into “win32”, And I now can run the code normally.
It’s right I’am new in coding and everything.
Thanks for your helping and hints.

Hi,

you are welcome.
[When you are new in C++ coding, you should read tutorials, a book and something else to understand
what C++ is, how to deal corretly with pointers … .etc]

First you should read the PhysX Guide to understand how PhysX works.
Then you should look into the Snippets, after that you should look into the Sample folder.
Of course, trying to change some values / add some features in the Snippets would help to understand PhysX.

Yes,Your tips are incredible helpful!
I think following your steps to learn is not bad!

By the way, can the snippets be compiled directly?
I open ‘Snippets.sln’ in ‘vc9win32’ and compile it, but an messageBox shows up for me to choose an exe.
And I don’t know what should be chosen.

Hi,

the snippets can be compiled directly. I dont know what messagebox you get, everything works fine on my laptop. Please explain it what the messagebox says or make a screenshot for us.

sorry, I intended to make a screenshot, but it’s not English version.
The general idea of the message box is: choose an executable file for the debugging session.
hope you don’t mind:

Hi.

Woha. I cant read this language :D

I guess you try to attach the Debugger to an application.

I´m using Visual Studio 2013 and you can switch the debugger to be
“local Windows Debuggger” which is default, some other and
“Remote Windows Debugger” which could be set as your default by mistake.
(Or attach to a process)

Try to change it, maybe this is the problem.

Now all seem fine.
Deeply Appreciate your help again.