Hey Chris,
Using the example code within Nimble External Call works for me, I even added the one line that appears to be causing my code to error.
cat('
#include <cstdio>
#include "add1.h"
void my_internal_function(double *p, double *ans, int n) {
printf("In my_internal_function\\n");
/* cat reduces the double slash to single slash */
#pragma omp parallel for
for(int i = 0; i < n; i++)
ans[i] = p[i] + 1.0;
}
')
This compiles with 0 issues, but when I try to use a similar workflow to use my function it errors. The line of code that I am adding to deal with parallelizing the loop is "#pragma omp parallel for" which in the context of the NimbleExternalCall example code works and does compile; however, when I try to compile my own function it will only compile without that line of code and it gives me these C++ errors.
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/Users/cp224670/AppData/Local/Temp/Rtmp6ZFC7h/HI1D.o:HI1D.cpp:(.text+0x1a72): undefined reference to `GOMP_parallel'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/Users/cp224670/AppData/Local/Temp/Rtmp6ZFC7h/HI1D.o:HI1D.cpp:(.text+0x2b7c): undefined reference to `omp_get_num_threads'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/Users/cp224670/AppData/Local/Temp/Rtmp6ZFC7h/HI1D.o:HI1D.cpp:(.text+0x2b83): undefined reference to `omp_get_thread_num'
collect2.exe: error: ld returned 1 exit status