Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:41:02+00:00 2026-06-04T23:41:02+00:00

This is the first time I am trying to use ATLAS. I am not

  • 0

This is the first time I am trying to use ATLAS. I am not able to link it properly. Here is a very simple sgemm program:

...
#include <cblas.h>


const int M=10;
const int N=8;
const int K=5;

int main()
{
    float *A = new float[M*K];
    float *B = new float[K*N];
    float *C = new float[M*N];

    // Initialize A and B

    cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1.0, A, K, B, N, 0.0, C, N);

        ...
}

When I compile it on a linux platform with standard ATLAS installation, it gives linking error:

g++ test.c -lblas -lcblas -latlas -llapack
/tmp/cc1Gu7sr.o: In function `main':
test.c:(.text+0x29e): undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const*, int, float const*, int, float, float*, int)'
collect2: ld returned 1 exit status

As you can see, I have tried giving different combination of libraries but didn’t help. What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:41:03+00:00Added an answer on June 4, 2026 at 11:41 pm

    You need

    extern "C"
    {
       #include <cblas.h>
    }
    

    because you compile with g++.

    Or you could even do

    #ifdef __cplusplus
    extern "C"
    {
    #endif
       #include <cblas.h>
    #ifdef __cplusplus
    }
    #endif
    

    to be able to compile as C also.

    When you compile in C++, names are expected to be mangled. But since cblas is compiled in C, the exported symbols don’t have mangled names. So you have to instruct the compiler to look for C-style symbols.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time trying Rcpp and this very simple problem is giving
this is my first time trying to use document classes in AS3 and im
This is my first time trying to use the XMLRPC::Client library to interact with
This is my first time trying to use any SCM so please bear with
This is my first time trying to use both ARC and Core Data. I
This is my first time really trying to use jQuery for my personal portfolio
this is the first time I'm trying to use html5 to display a video.
this is my first time trying to use java for backend web systems. I
This is my first time trying to use Web Start, and I am trying
This is my first time trying Pandas. I think I have a reasonable use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.