C++ "unresolved external symbol" using namespace from different project -
I have two projects (they are called Tests and Intrados) inside intrados, I have the following namespace:
#include "Mapper.h" #include "Director.h" #include "Driver.h" # include & lt; Iostream & gt; #include & lt; String & gt; using namespace std; Namespace IntradosMediaAir {Zero Edwheel (string); } Zero IntradosMediator :: addVehicle (string vehicleName) {Mapper * Mapper = Mapper :: getInstance (); Mapper-> AddVehicle (vehicleName); } From the inside of the introdose project, just by calling "intradosmdiyyart :: mapper (advils)" works just fine; So far, in the project test, the following code produces a link error:
#include "IntradosMediator.cpp" #include "Mapper.h" using the namespace intradosMediator; Int main () {IntradosMediator :: addVehicle ("Car X"); Return 0; } Error: Test.obj: Error LNK2019: unresolved external symbol "Public: Fixed square mapper * __cdecl mapper: getInstance (zero) "(GetInstance @ Mapper @@ SAPAV1 @ XZ) referred to in the function?" Zero __cdecl IntradosMediator :: addVehicle (class std :: basic_string & lt; four; struct std :: char_traits & lt; four & gt ;, class std :: Suppressive & lt; four & gt; & gt;) "(addVehicle @ IntradosMediator @@YAXV $ basic_string @ dw $ char_traits @ D @ STD @@ V $ $ @ D @ 2 @@ STD @@@ Z) I have made sure to add intrados as a reference for the test, and also included in the directories included in it. Not sure what to do here, because I'm new to C ++ thanks in advance for any advice. Edit: I'm adding mapper code here: // h #ifndef MAPPER_H # defined MAPPER_H #include & lt; String & gt; Using std :: string; Class Mapper {Public: Stationary Mapper * getInstance (); Zero addVehicle (string); Private: // This is a singleton mapper () {}; }; #endif //.cpp # include "Mapper.h" #Include & lt; Vector & gt; # Include & lt; Iostream & gt; #include & lt; String & gt; using namespace std; Of vector & lt; String & gt; VehicleList; Mapper * Mapper :: getInstance () {Fixed Mapper Frequency; Return and Example; } Zero Mapper :: addVehicle (string vehicle name) {vehicleList.push_back (vehicle name); } Error code says that the linker can not be found Mapper :: getInstance / Code> (It looks like your addVehicle function is OK). Do you want to include a library that enforces "mapper" in your link?
Comments
Post a Comment