Custom Project Macro definition error

11 views
Skip to first unread message

Shubhankar Kulkarni

unread,
Jul 2, 2022, 8:23:25 PM7/2/22
to ProjectChrono
Hello,
I am trying to implement a custom project using the tutorial steps enlisted. When I generate my project after giving the source, build and Chrono_DIR, I notice that the values of the CXX flags and C flags are as follows 

   CHRONO_CXX_FLAGS (Compiler flags): /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc;-openmp;/arch:AVX2;/arch:AVX;/Zc:__cplusplus;/wd4275

   CHRONO_C_FLAGS (Compiler flags): /DWIN32;/D_WINDOWS;/W3;-openmp;/arch:AVX2;/arch:AVX;;/wd4275

these are getting generated from the ChronoConfig.cmake or ChronoConfig.cmake.install I suppose.

However when I load my solution and my project in VS, I'm seeing this error of command-line error:invalid macro definition (refer attachment below). Unable to resolve it.
 
Thanks,
Shubhankar
VS_macro_error.PNG

Radu Serban

unread,
Jul 3, 2022, 4:11:59 AM7/3/22
to ProjectChrono

Shubhankar,

 

I suspect the problem is that you are setting the compiler flags listed in the variable CHRONO_CXX_FLAGS using obsolete CMake syntax.  Take a look at: https://github.com/projectchrono/chrono/blob/develop/CHANGELOG.md#changed-cmake-project-configuration-script and make sure your CMakeLists.txt uses target_compile_options to set the C++ flags for your project, just like it’s done in the latest version of the code for the template_project example.

 

If this does not fix your problem, please provide more details:

  • Which version of Chrono you are working with
  • What version of CMake you have
  • What compiler version you have

And attach the CMakeLists.txt file for your project.

 

--Radu

--
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 projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/de72a4f4-bf93-4026-a788-9991ddb88857n%40googlegroups.com.

Shubhankar Kulkarni

unread,
Jul 7, 2022, 12:26:57 AM7/7/22
to ProjectChrono
Radu,

Thanks a lot for pointing me to the solution. I was able to get past the macro errors and get my project running.

Sincerely,
Shubhankar

Reply all
Reply to author
Forward
0 new messages