- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Compile with MSVC 14 and above
Compile with MSVC 14 and above
Compile with MSVC 14 and above
Even though the gcc build runs fine, I'd like to know how to build with MSVC.
I have both the Platform Toolsets from:
- VS2015 | MSVC 14.0 | _MSC_VER == 1900
- VS2017 | MSVC 14.1 | _MSC_VER == 1910
Looking at C:\OpenModelica\share\omc\scripts\Compile.bat, it seems that VS2015 should be supported.
So
- I set up the environment in order to build with MSVC
- I compiled with omc with --target=msvc15 (that is quite misleading because it should be VS2015 or MSVC140, never mind...)
- I tried both with +simCodeTarget=Cpp and +simCodeTarget=C
- I compiled with nmake
and here are the results:
i) with +simCodeTarget=Cpp I get
Code:
fatal error C1853: 'C:/OpenModelica//include/omc/cpp/Core/Modelica.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
ii) with +simCodeTarget=C I get a long list of
Code:
error C2732: linkage specification contradicts earlier specification
that, by the way occur in the declaration of extern "c" functions
iii) with +simCodeTarget=C and forcing to not use the precompiled header (putting a PCH_FILE=<nothing> in the makefile)I get
Code:
Severity Code Description Project File Line Suppression State
Error LNK2038 mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in simulation.lib(simulation_runtime.cpp.obj)
so it seems that the simulation.lib library has been compiled with a _MSC_VER == 1800 i.e. VS2013 i.e. MSVC12.0 so it is not usable with other MSVC versions.
Is there any solution?
Does anyone successfully tried to build with MSVC?
- DarioMangoni
- 45 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Compile with MSVC 14 and above