'How to include a class from another project under the same Visual Studio Solution
I have two separate projects living in the same VS solution - "PhysicsWrapper" and "Test". The PhysicsWrapper project has a "Physics" class with its header and cpp file which I want to use in 'test'. The layout of the solution file system is like so:
$(SolutionDir)/
solution.sln
PhysicsWrapper/Physics.h & Physics.cpp
Test/test.cpp
In test.cpp I have
#include "../PhysicsWrapper/Physics.h"
int main(){
Physics* p = new Physics();
}
and I get the following error:
LNK2019 unresolved external symbol "public: __cdecl Physics::Physics(void)" (??0Physics@@QEAA@XZ) referenced in function main test C:\SolutionDir\test\source.obj
The things I've tried doing so far that were suggested in similar posts:
Include the path to the other project in C/C++ -> General -> Additional Include Directories as $(SolutionDir)\PhysXEngineWrapper as well as the full path without the macro and changing the include line to simply
#include "Physics.h"Including the paths to the libraries (PhysX) used in the "PhysicsWrapper" project in the "Test" project settings.
Include the path to the other project in VC++ Directories -> Include Directories and VC++ Directories -> Library Directories as $(SolutionDir)\PhysicsWrapper* as well as the full path without the macro.
Adding the "PhysicsWrapper" to "Test" 's project build dependencies.
Neither of the solutions helped. Both projects are also built in Debug x64.
EDIT: Also, when using p-> after the instantiation line I can see all of the methods in the Physics class you'd expect to.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
