Difficulty in setting OpenBLAS libraries in visual studio

343 views
Skip to first unread message

oyster li

unread,
Jan 29, 2016, 9:31:08 AM1/29/16
to OpenBLAS-users

Hello,

I try to use the OpenBLAS library in Visual Studio 2008 with the x64 computer and Win7 OS.

And, the project of the program is on the x86 platform.

So, I download the "mingw64_dll.zip" and "OpenBLAS-v0.2.14-Win64-int32.zip". on the site "http://sourceforge.net/projects/openblas/files/v0.2.14/".

Refering to the sites "https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio"
and "https://groups.google.com/forum/#!topic/openblas-users/YBfetRdPRlk", I take "libopenblas.dll.a" as lib, "libopenblas.dll' as bin,.
Copy the dlls "libgcc_s_seh-1.dll", "libgfortran-3.dll" and "libquadmath-0.dll" from the folder "mingw64_dll" to "OpenBLAS-v0.2.14-Win64-int32\bin".

Add the bin path to the system path and restart the computer.
Add the include path and lib path in the VS2008.
Add the file "libopenblas.dll.a" in the Linker ->Input->Additional Dependencies.

Finally, I can compile the program successfully with #include <cblas.h> and no code in the main.

Strangely, when I call the function from "cblas.h", it fails with the error "error LNK2019: 
unresolved external symbol _cblas_dgemm in the method _main
".

I know this might be a silly question, but could anybody give me an easy explanation?

Thanks

oyster li

unread,
Jan 29, 2016, 9:38:29 AM1/29/16
to OpenBLAS-users
Compiled Result 


oyster li

unread,
Jan 29, 2016, 9:53:47 AM1/29/16
to OpenBLAS-users
The testing code is here.
 
#include <cblas.h>
#include <stdio.h>

void main()
{
  int i=0;
  double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};         
  double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};  
  double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5}; 
  cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);

  for(i=0; i<9; i++)
    printf("%lf ", C[i]);
  printf("\n");

Zhang Xianyi

unread,
Feb 3, 2016, 3:55:55 PM2/3/16
to oyster li, OpenBLAS-users
Hi ,

The library is for x64 and your project is win32. Therefore, it cannot find the library.
Please change your project to x64 or download OpenBLAS win32 binary.

Xianyi

--
You received this message because you are subscribed to the Google Groups "OpenBLAS-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openblas-user...@googlegroups.com.
To post to this group, send email to openbla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

oyster li

unread,
Feb 5, 2016, 10:41:24 AM2/5/16
to OpenBLAS-users
Hi,  
I try to change the dll from "mingw64_dll" to "mingw32_dll", and the main library is "OpenBLAS-v0.2.14-Win64-int32".
.
It is still the same error "error LNK2019: unresolved external symbol _cblas_dgemm in the method _main".
Next, I try to use the "
OpenBLAS-v0.2.15-Win32" wtih "mingw32_dll" and "OpenBLAS-v0.2.15-Win32" with "mingw32_dll".
Successfully compile , but i receive another error "The application was unable to start correctly (0xc00007b)".
According to the site "
https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio",
it 
typically indicates a mismatch between 32/64-bit libraries.
And, my visual studio is x86, so i couldnt change the 
platform from x86 to x64.
Is it true that only few people use the openBLAS lib in visual studio, so that i could not find any tutorial step by step in detail.

Oyster Li
Reply all
Reply to author
Forward
0 new messages