Phorce
Phorce

Reputation: 4652

Linking .h file in GCC

I'm probably missing something really stupid here, but I have the following:

#include <clapack.h>

int main()
{
    std::cout << "This is a test";
    return 0;
}

I keep getting the error message: fatal error: clapack.h: No such file or directory

I tried using the following command:

g++ test.cpp -L /usr/lib/liblapack

But still returns the same error. Doing a search for "clapack.h" found that it was in the following directory: /usr/include/atlas/clpack.h

But, linking that directory using the -L command does not work either.

Anyone suggest to where I'm going wrong?

Upvotes: 1

Views: 145

Answers (1)

juanchopanza
juanchopanza

Reputation: 227578

Your problem is with include paths, not library paths. You need to either add the include path with -I/usr/include/atlas, or include like this:

#include <atlas/clapack.h>

assuming /usr/include is already in your path (which it most likely is).

I recommend you add some more compiler flas to get sensible warnings and errors. This is a typical set I use:

-Wall -Wextra -Wconversion -Wno-missing-field-initializers -pedantic-errors -std=c++11

Upvotes: 6

Related Questions