Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install C packages on windows

Tags:

c

package

lapack

I have to use LU decompostion to fit a simple model to some data (simulated) in C. An example of what I need to do is here:

However, I'm stuck with a more basic problem: how do I install packages in C and call them in my code?

I'm new in C and I'm used to R. But I have this assingment to do some tests about Matrix inversion, LU decomposision and the professor suggested using Lapack to easy things (thus, I don't need to code myself the LU decomposition etc.). But I don't know how to install the package and call it in my code, in order to use the functions of LAPACK.

I have a windows 7 64 bits and I'm using compiler Code Blocks 8.02

Thanks for any help.

like image 708
Manoel Galdino Avatar asked Dec 21 '22 19:12

Manoel Galdino


1 Answers

Normally you don't "install" C libraries in that sense. Normally, in Windows you have three types of files. The header files, typically ending in .h, the dynamic library, .dll, and most likely some linker files (typically, .lib, .a or something). The linker and compiler will need to be able to find these files somewhere. Normally you set the include directory paths, and library directory paths.

E.g. Let's say you downloaded a library called foo, and you extract it to C:\foo. In that folder, libfoo.a, foo.dll and foo.h reside. In Code::Blocks you will have to point include directory path to C:\foo and library path to C:\foo so that the linker and compiler know where to look for these files. Since you're linking against the foo library, you will also have to set -lfoo or something similiar in linker command line. This is GCC syntax, but I think Code::Blocks uses GCC compiler behind the scenes anyways.

In the C code you can just #include <foo.h> and the compiler will find it for you.

like image 133
Maister Avatar answered Jan 07 '23 01:01

Maister