Daniel – unless we can reproduce the issue, I don’t see how we could help.  
Since this only happens with your own code, you will need to provide us with a 
minimal reproducible example.
--Radu

From: [email protected] <[email protected]> On Behalf 
Of Daniel Zhan
Sent: Thursday, April 11, 2024 4:28 AM
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Unresolved External Symbol in project

Hi Radu,

Sorry for the long wait. This only happens when I build my project. When I 
build the same chrono_projects on github, they work properly. I've attached my 
CMakeCache.txt and pasted one of the errors below - all 9 look similar to that, 
although with different classes.

Error    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,float &,float &,float 
&,double,bool,bool,0>(float &,float &,float &,double &&,bool &&,bool &&)" 
(??$make_shared@VChBodyEasyBox@chrono@@AEAMAEAMAEAMN_N_N$0A@@chrono_types@@YA?AV?$shared_ptr@VChBodyEasyBox@chrono@@@std@@AEAM00$$QEAN$$QEA_N2@Z)
              bichir              
C:\Users\dzhan\Desktop\chrono\bichir\build\bichir.obj

Best,
Daniel


On Tuesday, January 23, 2024 at 9:57:50 AM UTC-5 Radu Serban wrote:
Daniel – that is not a solution.  The latest release (8.0) is almost one year 
old. There were many changes in the main branch, and these will be the object 
of a new release soon.
It’d be really useful to understand why you were getting these linking 
problems.  Could you please provide the answers to the questions below?

--Radu

From: [email protected] <[email protected]> On Behalf Of 
Daniel Zhan
Sent: Tuesday, January 23, 2024 3:31 PM
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Unresolved External Symbol in project

Hi all,

I was able to resolve the issue by rebuilding chrono using the release version 
on github rather than the contents of main branch - thanks.

Best,
Daniel
On Tuesday, January 23, 2024 at 3:39:38 AM UTC-5 Radu Serban wrote:
Hi Daniel,

Just to clarify:

  1.  Do you have any linking errors when building the Chrono libraries and 
demos?
  2.  Or does this only happen when you build your project (and link to a build 
or install Chrono tree)?

In either case, please

  *   Send the corresponding CMakeCache.txt file.
  *   Enable CMAKE_VERBOSE_MAKEFILE, rebuild, and post the complete output for 
the compiling/linking command that results in errors.

If the problem is #2 above, could you please try to clone the chrono-projects 
repository 
(https://github.com/projectchrono/chrono-projects<https://urldefense.com/v3/__https:/github.com/projectchrono/chrono-projects__;!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLwIUD3Fxw$>),
 then configure and build it to see if you also encounter issues? That 
repository assumes you have Chrono already built (you only need to specify 
where the Chrono CMake project configuration script is located); there are 
several projects in there, but only those that use Chrono modules that you had 
enabled will be configured and built.

Thanks,
Radu

From: [email protected] <[email protected]> On Behalf Of 
Daniel Zhan
Sent: Tuesday, January 23, 2024 4:30 AM
To: ProjectChrono <[email protected]>
Subject: Re: [chrono] Unresolved External Symbol in project

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<https://urldefense.com/v3/__https:/api.projectchrono.org/manual_core.html__;!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLyB7Inf0w$>

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://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/2e8da663-45f5-416d-a1fd-a9e8eb2ff88dn*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLzXk0bCDQ$>.
--
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<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/1a27ba57-076c-4237-a1bc-ca42f57bf061n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLybJTU9PQ$>.
--
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/318bf37b-f69e-42b1-aa32-c1b9c2856eban%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/318bf37b-f69e-42b1-aa32-c1b9c2856eban*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLy-PRM74Q$>.
--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/f1a7c1b7-3d6a-48cb-a24c-872cb711fcb8n%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/f1a7c1b7-3d6a-48cb-a24c-872cb711fcb8n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!JxAZaA1-WD3qG8vaZW6nL06ydleUtgaR0TjGJG7NUPBT9kjcrfRgTJHN2sZxKFhmHSi1fLzcSGDXEw$>.

-- 
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/PH0PR06MB823713896ACA950A1BEAA6C8A70B2%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to