Hi all,

I believe I was able to narrow the bug down to this line (among other 
similar ones) (this bug shows upon attempting to build):
auto object = chrono_types::make_shared<ChBodyEasyBox>(length, width, 
height, 100.0, true, true, material);

I made sure the arguments are of the correct types to initialize the object 
with a matching constructor, but still encounter error LNK2019. I am fairly 
certain the chrono_types::make_shared<> shared pointer constructor is 
working, as there are other objects in the source code using this same code 
that do not produce a LNK2019 error (or any other error). This leads me to 
believe that it is unlikely that I have linked my libraries improperly.

When I try using std::make_shared rather than chrono_types::make_shared, I 
only encounter a LNK2019 error with the delete operator, whereas using 
chrono_types::make_shared gives me two LNK2019 errors, involving the new 
and delete operators.

Best,
Daniel

On Saturday, January 20, 2024 at 6:47:30 PM UTC-5 [email protected] wrote:

> Hi Daniel,
> Indeed many things changed especially in the recent past, so it's a great 
> time to update old code. 
>
> It's surely better to look directly to the code instead of the error only, 
> but I would recommend to check few things:
>
> - call SetCollisionSystemType on your ChSystem (if you have contacts) 
> - please mind that the order and number of arguments of ChEasyBody changed
> - all the visual and collision shape changed
> - the way the ChSurfaceMaterial is passed to the bodies changes
>
> I would recommend you to check the docs
>
> https://api.projectchrono.org/manual_core.html
>
> And the Changelog in the repo! 
>
>
>
>
>
> -------- Messaggio originale --------
> Da: Daniel Zhan <[email protected]> 
> Data: 20/01/24 20:08 (GMT+01:00) 
> A: ProjectChrono <[email protected]> 
> Oggetto: [chrono] Unresolved External Symbol in project 
>
> Hi all,
>
> I've working on a simulation using Project Chrono - it's an old simulation 
> that someone else completed in 2018 using a presumably older version of 
> Chrono. I'm using Windows 11, Visual Studio 2022 and cmake to build the 
> project, and using the most up-to-date version of Chrono to continue 
> working on said project. 
>
> When attempting to build the project, I'm getting linker errors 
> (unrecognized external symbol) in Visual Studio Code, specifically:
>
> LNK2019 unresolved external symbol "__declspec(dllimport) public: static 
> void * __cdecl chrono::ChFrame<double>::operator new(unsigned __int64)" 
> (__imp_??2?$ChFrame@N@chrono@@SAPEAX_K@Z) referenced in function "class 
> std::shared_ptr<class chrono::ChBodyEasyBox> __cdecl 
> chrono_types::make_shared<class chrono::ChBodyEasyBox,double &,double 
> &,double &,double,bool,bool,class std::shared_ptr<class 
> chrono::ChMaterialSurfaceSMC> &,0>(double &,double &,double &,double 
> &&,bool &&,bool &&,class std::shared_ptr<class 
> chrono::ChMaterialSurfaceSMC> &)" 
> (??$make_shared@VChBodyEasyBox@chrono@@AEANAEANAEANN_N_NAEAV?$shared_ptr@VChMaterialSurfaceSMC@chrono@@@std@@$0A@@chrono_types@@YA?AV?$shared_ptr@VChBodyEasyBox@chrono@@@std@@AEAN00$$QEAN$$QEA_N2AEAV?$shared_ptr@VChMaterialSurfaceSMC@chrono@@@2@@Z)
>
> This error shows a linking problem in that the program could not find the 
> new operator in ChFrame. I have 3 other errors denoting linker problems 
> with the delete operator for ChFrame, along with the new and delete operators 
> for ChLinkLock. I'm wondering if the source files in Project Chrono have 
> since changed to no longer support these operators or if there's something 
> wrong with how I built the project.
>
> Best,
> Daniel
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "ProjectChrono" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/projectchrono/2e8da663-45f5-416d-a1fd-a9e8eb2ff88dn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/projectchrono/2e8da663-45f5-416d-a1fd-a9e8eb2ff88dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/1a27ba57-076c-4237-a1bc-ca42f57bf061n%40googlegroups.com.

Reply via email to