I'm trying to make a simple FEM program using CPPLapack + clapack. Unfortunately, the strange linking error happens.
1>clapack.lib(xerbla.obj) : error LNK2019: unresolved external symbol __imp__printf referenced in function _xerbla_
1>Release/fem10.exe : fatal error LNK1120: 1 unresolved externals
There is no _imp_printf function called in xerbla.c source file. The dealing of 'C' calling might induce this problem, i.e. "extern 'C' ...." in cpplapack.h.
Much more simple example ("source1" in the following) does not cause this error, although the cpplapack.h is included in the same way.
Please someone tell me how to resolve the above linking error problem.
[[source1]]
#include <cpplapack.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
//// make dgematrix A ////
CPPL::dgematrix A(3,3);
A(0,0)=1; A(0,1)=1; A(0,2)=-2;
A(1,0)=-3; A(1,1)=2; A(1,2)=1;
A(2,0)=3; A(2,1)=-1; A(2,2)=2;
//// make dcovector y ////
CPPL::dcovector y(3);
y(0)=1;
y(1)=2;
y(2)=3;
//// solve Ax=y ////
A.dgesv(y);
//// print ////
std::cout << "x=\n" << y << std::endl;
Hi!
I'm trying to make a simple FEM program using CPPLapack + clapack. Unfortunately, the strange linking error happens.
1>clapack.lib(xerbla.obj) : error LNK2019: unresolved external symbol __imp__printf referenced in function _xerbla_
1>Release/fem10.exe : fatal error LNK1120: 1 unresolved externals
There is no _imp_printf function called in xerbla.c source file. The dealing of 'C' calling might induce this problem, i.e. "extern 'C' ...." in cpplapack.h.
Much more simple example ("source1" in the following) does not cause this error, although the cpplapack.h is included in the same way.
Please someone tell me how to resolve the above linking error problem.
[[source1]]
#include <cpplapack.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
//// make dgematrix A ////
CPPL::dgematrix A(3,3);
A(0,0)=1; A(0,1)=1; A(0,2)=-2;
A(1,0)=-3; A(1,1)=2; A(1,2)=1;
A(2,0)=3; A(2,1)=-1; A(2,2)=2;
//// make dcovector y ////
CPPL::dcovector y(3);
y(0)=1;
y(1)=2;
y(2)=3;
//// solve Ax=y ////
A.dgesv(y);
//// print ////
std::cout << "x=\n" << y << std::endl;
cout << "end of test!" << cout;
return 0;
}
[[source2 (under construction) ]]
#include <cpplapack.h>
#include <iostream>
using namespace std;
static int g2DState;
CPPL::dgematrix gB(3,6);
CPPL::dgematrix gBt(6,3);
CPPL::dgematrix gD(3,3);
CPPL::dgematrix gK(6,6);
double gE;
double gNu;
long glNode;
vector< CPPL::dcovector > gPos;
vector< vector< long > > gElm;
void SetK(long i, long j, long k);
int _tmain(int argc, _TCHAR* argv[])
{
gPos.resize(glNode);
return 0;
}
void SetD(void)
{
double c;
switch(g2DState){
case 0:
c = gE/(1.0-gNu*gNu);
gD(0,0) = c;
gD(0,1) = c*gNu;
gD(0,2) = 0.0;
gD(1,0) = c*gNu;
gD(1,1) = c;
gD(1,2) = 0.0;
gD(2,0) = 0.0;
gD(2,1) = 0.0;
gD(2,2) = c*0.5*(1.0-gNu);
break;
case 1:
c = gE*(1.0-gNu)/((1.0+gNu)*(1.0-2.0*gNu));
gD(0,0) = c;
gD(0,1) = c*gNu/(1.0-gNu);
gD(0,2) = 0.0;
gD(1,0) = c*gNu/(1.0-gNu);
gD(1,1) = c;
gD(1,2) = 0.0;
gD(2,0) = 0.0;
gD(2,1) = 0.0;
gD(2,2) = c*0.5*(1.0-2.0*gNu)/(1.0-gNu);
break;
}
}
void SetB(long i, long j, long k)
{
double xi = gPos[i](0);
double yi = gPos[i](1);
double xj = gPos[j](0);
double yj = gPos[j](1);
double xk = gPos[k](0);
double yk = gPos[k](1);
double aa;
aa = 1.0/((xj*xk-yj*yk)+(xk*xi-yk*yi)+(xi*xj-yi*yj));
gB(0,0) = aa*(yj-yk);
gB(0,1) = 0.0;
gB(0,2) = aa*(yk-yi);
gB(0,3) = 0.0;
gB(0,4) = aa*(yi-yj);
gB(0,5) = 0.0;
gB(1,0) = 0.0;
gB(1,1) = aa*(xk-xj);
gB(1,2) = 0.0;
gB(1,3) = aa*(xi-xk);
gB(1,4) = 0.0;
gB(1,5) = aa*(xj-xi);
gB(2,0) = aa*(xk-xj);
gB(2,1) = aa*(yj-yk);
gB(2,2) = aa*(xi-xk);
gB(2,3) = aa*(yk-yi);
gB(2,4) = aa*(xj-xi);
gB(2,5) = aa*(yi-yj);
gBt = t(gB);
}
void SetK(long i)
{
SetB(gElm[i][0], gElm[i][1], gElm[i][2]);
gK = gBt*gD*gB;
}