0

For starters, I went through several similar asks and topics and found no answer (or didn't know how to apply it). I'm using VS 2019 and newest LAPACK. For starters, here's what I did so far:

  • downloaded LAPACK repo
  • changed the cmake file to also build cblas
  • used CMake to generate project
  • build said project (wouldn't let me launch it, so I guessed that that's how it's supposed to be done)
  • passed folder with header files to Include Directories (LIBPATH), folder with .lib files to Library Directories (LIB) and the .lib files themselves (lapack.lib, lapacke.lib, blas.lib, cblas.lib) as Additional Dependencies of the linker

Then attempted to launch the following code just to get hit with "unresolved external symbol _cblas_dgemv referenced in function _main":

#include<stdio.h>
#include<math.h>
#include<time.h>

#include <stdlib.h>

#include "cblas.h"
#include <complex>
#define lapack_complex_float std::complex<float>
#define lapack_complex_double std::complex<double>
#include "lapacke.h"


#define n 2000
#define n2 n*n

int main()
{
    double* Af = (double*)calloc(n2, sizeof(double));

    double* x = (double*)calloc(n, sizeof(double));
    for (int i = 0; i < n; i++)
    {
        x[i] = i + 1;
    }

    double* b = (double*)calloc(n, sizeof(double));

    cblas_dgemv(CblasRowMajor, CblasTrans, n, n, 1, Af, n, x, 1, 0, b, 1);
    for (int i = 0; i < 20; i++)
        printf(" b%d = %f\n", i, b[i]);
}

Following some random advice found on the net I also tried changing compilation type from default to C but that one resulted wit literal thousands of errors from other dependencies (files such as "atomic", not quite sure but I suspect they come from base libraries).

Daractive
  • 67
  • 6
  • 1
    Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ken White Oct 17 '20 at 23:49
  • @KenWhite I don't really see my case in this post, but I would consider this solved, sadly with not much to be learned from it. The first issue (the one from question above) got solved after recompiling libraries to Win32/Debug (supposed conflict between project and library settings, still no luck with forcing it to swallow x64). The second one (slightly offtopic but might help someone trying to do the same) was with mangling. To be precise lapacke.lib calling for lower case lapack.lib routines and finding none due to them being all upper case. – Daractive Oct 18 '20 at 17:29
  • Adding -DUPPER as a LAPACKE project compilation flag seems to have solved it. – Daractive Oct 18 '20 at 17:30

0 Answers0