- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » target=msvc
target=msvc
target=msvc
Hi all, I'm using OpenModelica 1.9.3. When I'm compiling a model with target set to msvc I'm getting this error:
Code:
IModel.obj : error LNK2019: unresolved external symbol _checkForSynchronous referenced in function "int __cdecl IModel_performSimulation(struct DATA *,struct threadData_s *,struct SOLVER_INFO *)" (?IModel_performSimulation@@YAHPAUDATA@@PAUthreadData_s@@PAUSOLVER_INFO@@@Z)
IModel.obj : error LNK2019: unresolved external symbol _handleTimers referenced in function "int __cdecl simulationUpdate(struct DATA *,struct threadData_s *,struct SOLVER_INFO *)" (?simulationUpdate@@YAHPAUDATA@@PAUthreadData_s@@PAUSOLVER_INFO@@@Z)
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv_init referenced in function _initializeNLScsvData
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv referenced in function _print_csvLineCallStatsHeader
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv_free referenced in function _freeNonlinearSystems
initialization.lib(initialization.c.obj) : error LNK2019: unresolved external symbol _initSynchronous referenced in function _initialization
IModel.exe : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Any idea how to solve that, please?
Thanks, Josef
Re: target=msvc
- adrpo
- 885 Posts
Re: target=msvc
I tried, but I'm still getting an error.
Please, any idea why?
Thanks!
Code:
IModel.obj : error LNK2019: unresolved external symbol _checkForSynchronous referenced in function "int __cdecl IModel_performSimulation(struct DATA *,struct threadData_s *,struct SOLVER_INFO *)" (?IModel_performSimulation@@YAHPAUDATA@@PAUthreadData_s@@PAUSOLVER_INFO@@@Z)
IModel.obj : error LNK2019: unresolved external symbol _handleTimers referenced in function "int __cdecl simulationUpdate(struct DATA *,struct threadData_s *,struct SOLVER_INFO *)" (?simulationUpdate@@YAHPAUDATA@@PAUthreadData_s@@PAUSOLVER_INFO@@@Z)
solver.lib(linearSystem.c.obj) : error LNK2019: unresolved external symbol _freeKluData referenced in function _freeLinearSystems
solver.lib(linearSystem.c.obj) : error LNK2019: unresolved external symbol _allocateKluData referenced in function _initializeLinearSystems
solver.lib(linearSystem.c.obj) : error LNK2019: unresolved external symbol _solveKlu referenced in function _solve_linear_system
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv_init referenced in function _initializeNLScsvData
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv referenced in function _print_csvLineCallStatsHeader
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _allocValueList referenced in function _initializeNonlinearSystems
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _omc_write_csv_free referenced in function _freeNonlinearSystems
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _freeValueList referenced in function _freeNonlinearSystems
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _cleanValueListbyTime referenced in function _cleanUpOldValueListAfterEvent
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _addListElement referenced in function _solve_nonlinear_system
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _createValueElement referenced in function _solve_nonlinear_system
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _getValues referenced in function _solve_nonlinear_system
solver.lib(nonlinearSystem.c.obj) : error LNK2019: unresolved external symbol _printValuesListTimes referenced in function _solve_nonlinear_system
util.lib(modelica_string.c.obj) : error LNK2019: unresolved external symbol _va_copy referenced in function _GC_vasprintf
initialization.lib(initialization.c.obj) : error LNK2019: unresolved external symbol _initSynchronous referenced in function _initialization
IModel.exe : fatal error LNK1120: 17 unresolved externals
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
RESULT: 2
Re: target=msvc
Ok, it seems we're not compiling and linking some runtime code for the MSVC C target. I'll open a ticket about it and have a look.
Maybe it works better with the C++ runtime: +simCodeTarget=Cpp.
In OMEdit try to choose Cpp from drop-down options of Target Language and msvc
from drop-down options of Target Compiler in Tools->Options->Simulation and try to
build again.
- adrpo
- 885 Posts
Re: target=msvc
I tested the Cpp code target with msvc, but it does not work. I got quite a bit of warnings and errors about undeclared identifiers:
error C2065: 'tmp39' : undeclared identifier
error C2065: 'tmp39' : undeclared identifier
and about syntax error:
error C2146: syntax error : missing ';' before identifier 'tmp39'
Thank you for your help.
Re: target=msvc
When I use Cpp target for a simple model it does compile the model. It looks to me it has something to do with change() function in the when-statement.
Also I found some issue in C++ generated code (see bellow), the second else if statement starts wrongly with forward slash.
When I delete this then I can compile the Cpp target by re-running nmake.
Code:
void IModel::evaluate_482()
{
if (_initial)
{
; // nothing to do
}
else if(0 || (_$whenCondition15 && !_discrete_events->pre(_$whenCondition15)))
{
_state_var_reinitialized = true;
__z[24] = 0.0;
}
/else if(0 || (_$whenCondition14 && !_discrete_events->pre(_$whenCondition14)))
{
_state_var_reinitialized = true;
__z[24] = 0.0;
}
else if(0 || (_$whenCondition13 && !_discrete_events->pre(_$whenCondition13)))
{
_state_var_reinitialized = true;
__z[24] = 0.0;
}
else
{
; // nothing to do
}
}
Thanks.
Re: target=msvc
Hi Josef,
I am Akshay. I am trying to compile the model with cpp and msvc targets. I am getting the same errors as you have stated. How did you manage to solve this issue? Please help me. It is very important for me to use this compiler so that I can co-simulate this model with Carmaker.
Thank you in advance
Best Regards
Akshay
Re: target=msvc
Hi Akshay,
unfortunately I had to give up this activity. Only simple model could be compiled. More complex models would require manual checking which is very difficult.
There are other way to co-simulate with CarMaker. What about making FMU out of your model.
Regards,
Josef
Re: target=msvc
My company requires me to model the physical components using Open Modelica. So do you mean, there are tools where the modelica models can be exported into FMU for co-simulation with CarMaker?? Can you please suggest me any such tool where I can export my modelca model to FMU.
Thank you so much for your time. I appreciate your help.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » target=msvc