r-windows / docs

Documentation for rtools40 and R for Windows
31 stars 10 forks source link

undefined reference to `error' collect2.exe: error: ld returned 1 exit status #16

Closed platanus-study closed 4 years ago

platanus-study commented 4 years ago

Hello, all members.

I'm studying R programming because of simulation analysis.

I'm compiling c file for making .o and .dll files.

But I have some problem regarding compiling error.

The problem is as follow.

----------------- R code Input command for compiliing c file--------------------------------

D:\kyuri_kim\CiPA\CiPA_Rocde\CiPA-master\AP_simulation\models>R CMD SHLIB newordherg_qNet.c

------------------The error occurred aftering compiling in rstudio---------------------------

"C:/rtools40/mingw64/bin/"gcc -I"C:/PROGRA~1/R/R-40~1.0/includ e" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c newordherg_qNet.c -o newordherg_qNet.o newordherg_qNet.c: In function 'derivs': newordherg_qNet.c:133:17: warning: implicit declaration of func tion 'error' [-Wimplicit-function-declaration] if (ip[0] < 8 ) error("nout not enough!"); //7 currents as a dditional output plus dv (ydot[0]) ^~~~~ newordherg_qNet.c:219:20: warning: implicit declaration of func tion 'log' [-Wimplicit-function-declaration] double ENa=(RT/F)log(nao/nai); ^~~ newordherg_qNet.c:219:20: warning: incompatible implicit declar ation of built-in function 'log' newordherg_qNet.c:219:20: note: include '' or provide a declaration of 'log' newordherg_qNet.c:65:1: +#include static double parms[59]; //celltype plus 7 channels plus hER GMM parameters newordherg_qNet.c:219:20: double ENa=(RT/F)log(nao/nai); ^~~ newordherg_qNet.c:229:21: warning: implicit declaration of func tion 'exp' [-Wimplicit-function-declaration] double mss=1.0/(1.0+exp((-(v+39.57))/9.871)); ^~~ newordherg_qNet.c:229:21: warning: incompatible implicit declar ation of built-in function 'exp' newordherg_qNet.c:229:21: note: include '' or provide a declaration of 'exp' newordherg_qNet.c:251:24: warning: implicit declaration of func tion 'pow' [-Wimplicit-function-declaration] double INa=GNa(v-ENa)pow(m,3.0)((1.0-fINap)hj+fINaphpjp ); ^~~ newordherg_qNet.c:251:24: warning: incompatible implicit declar ation of built-in function 'pow' newordherg_qNet.c:251:24: note: include '' or provide a declaration of 'pow' newordherg_qNet.c:380:16: warning: implicit declaration of func tion 'sqrt' [-Wimplicit-function-declaration] double IKr=GKrsqrt(ko/5.4)O(v-EK); ^~~~ newordherg_qNet.c:380:16: warning: incompatible implicit declar ation of built-in function 'sqrt' newordherg_qNet.c:380:16: note: include '' or provide a declaration of 'sqrt' C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o neword herg_qNet.dll tmp.def newordherg_qNet.o -LC:/PROGRA~1/R/R-40~1. 0/bin/x64 -lR C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../ ../../../x86_64-w64-mingw32/bin/ld.exe: newordherg_qNet.o:newor dherg_qNet.c:(.text+0x3e18): undefined reference to `error' collect2.exe: error: ld returned 1 exit status

D:\kyuri_kim\CiPA\CiPA_Rocde\CiPA-master\AP_simulation\models>R CMD SHLIB newordherg_qNet.c "C:/rtools40/mingw64/bin/"gcc -I"C:/PROGRA~1/R/R-40~1.0/includ e" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c newordherg_qNet.c -o newordherg_qNet.o newordherg_qNet.c: In function 'derivs': newordherg_qNet.c:133:17: warning: implicit declaration of func tion 'error' [-Wimplicit-function-declaration] if (ip[0] < 8 ) error("nout not enough!"); //7 currents as a dditional output plus dv (ydot[0]) ^~~~~ newordherg_qNet.c:219:20: warning: implicit declaration of func tion 'log' [-Wimplicit-function-declaration] double ENa=(RT/F)log(nao/nai); ^~~ newordherg_qNet.c:219:20: warning: incompatible implicit declar ation of built-in function 'log' newordherg_qNet.c:219:20: note: include '' or provide a declaration of 'log' newordherg_qNet.c:65:1: +#include static double parms[59]; //celltype plus 7 channels plus hER GMM parameters newordherg_qNet.c:219:20: double ENa=(RT/F)log(nao/nai); ^~~ newordherg_qNet.c:229:21: warning: implicit declaration of func tion 'exp' [-Wimplicit-function-declaration] double mss=1.0/(1.0+exp((-(v+39.57))/9.871)); ^~~ newordherg_qNet.c:229:21: warning: incompatible implicit declar ation of built-in function 'exp' newordherg_qNet.c:229:21: note: include '' or provide a declaration of 'exp' newordherg_qNet.c:251:24: warning: implicit declaration of func tion 'pow' [-Wimplicit-function-declaration] double INa=GNa(v-ENa)pow(m,3.0)((1.0-fINap)hj+fINaphpjp ); ^~~ newordherg_qNet.c:251:24: warning: incompatible implicit declar ation of built-in function 'pow' newordherg_qNet.c:251:24: note: include '' or provide a declaration of 'pow' newordherg_qNet.c:380:16: warning: implicit declaration of func tion 'sqrt' [-Wimplicit-function-declaration] double IKr=GKrsqrt(ko/5.4)O(v-EK); ^~~~ newordherg_qNet.c:380:16: warning: incompatible implicit declar ation of built-in function 'sqrt' newordherg_qNet.c:380:16: note: include '' or provide a declaration of 'sqrt' C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o neword herg_qNet.dll tmp.def newordherg_qNet.o -LC:/PROGRA~1/R/R-40~1. 0/bin/x64 -lR C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../ ../../../x86_64-w64-mingw32/bin/ld.exe: newordherg_qNet.o:newor dherg_qNet.c:(.text+0x3e18): undefined reference to `error' collect2.exe: error: ld returned 1 exit status

I'm using tools such as R 4.0.0 and Rtools40 in Windows 10 (64bit).

I already check tips Rtools installation and setting using reference as follows. https://cran.r-project.org/bin/windows/Rtools/ https://github.com/r-windows/docs/blob/master/faq.md#readme

Do you know how to solve above error?

If you have solution regarding the error, you can let me know.