Opened 16 years ago

Last modified 15 years ago

#1095 closed defect (fixed)

div operator not supported correctly

Reported by: casella Owned by: casella
Priority: high Milestone:
Component: Version: 1.4.5
Keywords: Cc: casella,

Description

The following simple model

model Test
  Real y = div(time,0.2);
end Test;

gives the following compilation errors, instead of producing an executable simulator. This is a problem when one wants to implement, e.g., piecewise linear interpolations, or similar models.

g++ -I"C:\Programmi\OpenModelica1.4.5\/include" -msse2 -mfpmath=sse  -I. -I"E:/Temp" -o Test.exe Test.cpp -L"E:/Temp" -lsim -L"C:\Programmi\OpenModelica1.4.5\/lib" -lc_runtime -lf2c -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32
Test.cpp: In function int functionDAE_output()': \\Test.cpp:349: error: div_rettype' was not declared in this scope
Test.cpp:349: error: expected ;' before "tmp0" \\Test.cpp:351: error: tmp0' was not declared in this scope
Test.cpp:351: error: call of overloaded div(double&, double)' is ambiguous \\C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:383: note: candidates are: div_t div(int, int) \\C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:161: note:                 lldiv_t __gnu_cxx::div(long long int, long long int) \\C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:126: note:                 ldiv_t std::div(long int, long int) \\Test.cpp: In function int function_updateDependents()':
Test.cpp:437: error: div_rettype' was not declared in this scope \\Test.cpp:437: error: expected ;' before "tmp0"
Test.cpp:441: error: tmp0' was not declared in this scope \\Test.cpp:441: error: call of overloaded div(double&, double)' is ambiguous
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:383: note: candidates are: div_t div(int, int)
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:161: note:                 lldiv_t gnu_cxx::div(long long int, long long int)
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:126: note:                 ldiv_t std::div(long int, long int)
Test.cpp: In function int initial_residual()': \\Test.cpp:475: error: div_rettype' was not declared in this scope
Test.cpp:475: error: expected ;' before "tmp0" \\Test.cpp:479: error: tmp0' was not declared in this scope
Test.cpp:479: error: call of overloaded `div(double&, double)' is ambiguous
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:383: note: candidates are: div_t div(int, int)
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:161: note:                 lldiv_t
gnu_cxx::div(long long int, long long int)
C:/Programmi/OpenModelica1.4.5/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cstdlib:126: note:                 ldiv_t std::div(long int, long int)
mingw32-make: * [Test] Error 1

Change History (1)

comment:1 Changed 15 years ago by perost

Missing div function has now been implemented.

Note: See TracTickets for help on using tickets.