NVIDIAGameWorks / PhysX

NVIDIA PhysX SDK
Other
3.15k stars 796 forks source link

Unresolved external symbol PxCreatePvd referenced in function main. #228

Open BartekPawlak opened 4 years ago

BartekPawlak commented 4 years ago

Hi, i got the error as in the title. In the VS2017 project, in the folder with the .cpp file, I placed the files:

PhysX_64.dll PhysXCommon_64.dll PhysXCooking_64.dll PhysXFoundation_64.dll PhysXGpu_64.dll

I added files to the linker in the input data: d2d1.lib d3d9.lib PhysXCharacterKinematic_static_64.lib PhysXTask_static_64.lib PhysX_64.lib;PhysXCooking_64.lib PhysXFoundation_64.lib PhysXCommon_64.lib

I think the PxCreatePvd function body is missing, but I didn't find it in the downloaded PhysX-4.1. I need to create this function or is there a better solution to this problem? What solution? There is a similar error with PxDefaultPvdSocketTransportCreate.

This is my code: `

include "PxPhysicsAPI.h"

include

include

using namespace physx; using namespace std;

define PVD_HOST "127.0.0.1"

class PxAllocatorCallback { public: virtual ~PxAllocatorCallback() {} virtual void allocate(size_t size, const char typeName, const char filename, int line) = 0; virtual void deallocate(void ptr) = 0; };

class UserErrorCallback : public PxErrorCallback { public: virtual void reportError(PxErrorCode::Enum code, const char message, const char file, int line) { cout << "Error:" << endl<<" code: "<<code<<endl<<" message: "<<message<<endl<<" file: "<<file<<endl<<" line: "<<line<<endl; } };

int main() { cout << "Hello CMake." << endl;

PxTolerancesScale scale;
scale.length = 100;
scale.speed = 981;

static UserErrorCallback gDefaultErrorCallback;
static PxDefaultAllocator gDefaultAllocatorCallback;

PxFoundation* mFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gDefaultAllocatorCallback,
    gDefaultErrorCallback);
if (!mFoundation)
    cout << "PxCreateFoundation failed!" << endl;

bool recordMemoryAllocations = true;

PxFoundation* gFoundation = NULL;
PxPvd* mPvd = PxCreatePvd(*mFoundation);
PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10);
mPvd->connect(*transport, PxPvdInstrumentationFlag::eALL);

PxPhysics* mPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *mFoundation,
    PxTolerancesScale(), recordMemoryAllocations, mPvd);
if (!mPhysics)
    cout<<"PxCreatePhysics failed!"<<endl;

PxCooking* mCooking = PxCreateCooking(PX_PHYSICS_VERSION, *mFoundation, PxCookingParams(scale));
if (!mCooking)
    cout << "PxCreateCooking failed!" << endl;

mPhysics->release();
mCooking->release();
mFoundation->release();

return 0;

}

`

I'm using cout to display errors because I don't know what library fatalError () is in at the moment. I will repeat the question. I need to create this function or is there a better solution to this problem? What solution?

I apologize for the code. I write something here for the first time.

amoravanszky commented 4 years ago

If for whatever reason the PxCreatePvd() call is giving you trouble, you can just comment it out, and replace passing it with NULL in PxCreatePhysics()...it is entirely optional.

You do however have the source for that function, it is here:

https://github.com/NVIDIAGameWorks/PhysX/blob/4.1/physx/source/pvd/src/PxPvd.cpp

You probably forgot to reference PhysxPvdSDK_64.lib