- Index
- » Users
- » Mikey
- » Profile
Posts
Posts
Thanks, that seemed to fix it.
I tried removing the extraneous includes and annotations, however i continue to get the same error. In addition I tried renaming the c-file to isolate whether it was the modelica function or the c-file, ithe name stayed the same leading me to believe that the reference that it can't find is the modelica function. The modelica function passes the check test in open modelica, so I am still unsure of the problem.
I am trying to load the system time in milliseconds from an external C function and keep running into an error. I believe it is modelica and not the C function but just in case these are the functions I am using
C
#include <sys/time.h>
int systm()
{
struct timeval tv;
gettimeofday(&tv, 0);
int tm=(int)tv.tv_usec;
return int;
}
Modelica function:
function systm
annotation(__OpenModelica_Impure = true);
input Real x;
output Real tm;
external "C" tm=systm();
annotation(Include="#include <systm.c>", Include="#include <sys/time.h>",__OpenModelica_Impure = true );
end systm;
Modelica Model:
model test
annotation(Include="#include <systm.c>", Include="#include <sys/time.h>",__OpenModelica_Impure = true );
Real tt;
algorithm
tt:=systm(0);
end test;
The error message I keep getting is
Translation 17:34:42 0:0-0:0 Error building simulator. Buildlog: gcc -falign-functions -msse2 -mfpmath=sse -I"C:/OpenModelica1.9.0//include/omc" -I. -c -o pack.test.o pack.test.c
gcc -falign-functions -msse2 -mfpmath=sse -I"C:/OpenModelica1.9.0//include/omc" -I. -c -o pack.test_records.o pack.test_records.c
g++ -I. -o pack.test.exe pack.test.o pack.test_records.o -I"C:/OpenModelica1.9.0//include/omc" -I. -falign-functions -msse2 -mfpmath=sse -L"C:/OpenModelica1.9.0//lib/omc" -lSimulationRuntimeC -linteractive -lregex -lexpat -static-libgcc -luuid -lole32 -lws2_32 -lsundials_kinsol -lsundials_nvecserial -llapack-mingw -Wl,-Bstatic -lf2c -Wl,-Bdynamic
pack.test.o:pack.test.c.text+0x2c): undefined reference to `systm'
collect2: ld returned 1 exit status
mingw32-make: *** [omc_main_target] Error 1
- Index
- » Users
- » Mikey
- » Profile