Posted By: SBGuy
LNK1120 unresolved externals when compiling simple brokerAsset - 01/15/19 23:03
This simple thing is driving my nuts.
I'm trying to get a single real-time price in a dummy Broker API with this BrokerAsset function.
Whenever I try to use std::stod to convert the result text to a price double, Visual Studio gives me a compiler error. If I comment the std:stod line and set price =0, it compiles fine. I'm not a C++ guy, just a hacker using the AllyVest source code as a template.
Thanks for any help.
================
ActiveTick.cpp
Creating library
....DebugActiveTick.lib and object
....DebugActiveTick.exp
ActiveTick.obj : error LNK2019: unresolved external symbol __CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned int)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPAXI@Z)
...DebugActiveTick.dll : fatal error LNK1120: 1 unresolved externals
Done building project "ActiveTick.vcxproj" -- FAILED.
I'm trying to get a single real-time price in a dummy Broker API with this BrokerAsset function.
Whenever I try to use std::stod to convert the result text to a price double, Visual Studio gives me a compiler error. If I comment the std:stod line and set price =0, it compiles fine. I'm not a C++ guy, just a hacker using the AllyVest source code as a template.
Thanks for any help.
Code:
DLLFUNC_C int BrokerAsset(char* Asset, double *pPrice, double *pSpread, double *pVolume, double *pPip, double *pPipCost, double *pLotAmount, double *pMarginCost, double *pRollLong, double *pRollShort) { char url[50] = "https://api.iextrading.com/1.0"; int id = http_send(url, 0, 0); int n = http_status(id); double price = 0, spread = 0; char output[50]; http_result(id, output, n); //get the price price = std::stod(output); http_free(id); //always clean up the id! if (!pPrice) return 1; if (pPrice) *pPrice = price; if (pSpread) *pSpread = spread; if (price > 0) return 1; else return 0; }
================
ActiveTick.cpp
Creating library
....DebugActiveTick.lib and object
....DebugActiveTick.exp
ActiveTick.obj : error LNK2019: unresolved external symbol __CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned int)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPAXI@Z)
...DebugActiveTick.dll : fatal error LNK1120: 1 unresolved externals
Done building project "ActiveTick.vcxproj" -- FAILED.