Consider the next C/C++ code:
//Main.c
#include <stdio.h>
#include "mkl_cblas.h"
int tfuuuuuuuuuuuuuu()
{
int Num = 10;
double A[30] = {0.0};
double B[30] = {0.0};
double C[9];
cblas_dgemm(CblasRowMajor, CblasTrans, CblasNoTrans, 3, 3, Num, 1.0, A, 3, B, 3, 0.0, C, 3);
return 0;
}
Building this in MSVC 2015 (x64 Win7) in a DLL project gives linker error:
unresolved external symbol cblas_dgemm referenced in function tfuuuuuuuuuuuu
As it should because I did not link against the blas library.
But building the same code in gcc (8.2.0, Centos7)
$ gcc -c -fPIC -I./include -o Main.o Main.c
$ gcc -shared -o libTest.so Main.o
didn't give any linking errors!.
Why am I not getting the linker error even though I didn't link against the needed library?
Is there a linker option to force linker error in this case?