How add a C library to Windows?

455 Views Asked by At

I am new to the C programming language, and I have a C library. Based on the code writer statement HERE, it compiles for 32-bit Windows and has a DLL file.

I want to know in detail, how can I add it to my PC in a way that compiler and IDE can find it easily. This library will be used in a program with the main structure written in the Fortran language.

I read the instrument of the library. There is something about installing the library. So I add a directory path to it.

Based on the readme in the library, I run this command:

g++ `pkg-config --cflags --libs qhullcpp qhullstatic_r` -o my_app my_app.cpp

and:

g++ `pkg-config --cflags --libs qhullcpp qhull_r` -o my_app my_app.cpp

in the Cygwin with the "pkg-config" tool. It shows:

Package qhullcpp was not found in the pkg-config search path. Perhaps you should add the directory containing `qhullcpp.pc' to the PKG_CONFIG_PATH environment variable Package 'qhullcpp', required by 'virtual:world', not found Package 'qhullstatic_r', required by 'virtual:world', not found g++.exe: error: my_app.cpp: No such file or directory g++.exe: fatal error: no input files compilation terminated.

and:

Package qhullcpp was not found in the pkg-config search path. Perhaps you should add the directory containing `qhullcpp.pc' to the PKG_CONFIG_PATH environment variable Package 'qhullcpp', required by 'virtual:world', not found Package 'qhull_r', required by 'virtual:world', not found g++.exe: error: my_app.cpp: No such file or directory g++.exe: fatal error: no input files compilation terminated.

respectively. Can anyone help to solve this problem and install the library?

I will appreciate any comments that give me a little help and forgive me for writing shortcomings.

1

There are 1 best solutions below

1
On

As you put the cygwin tag, be aware that the package is already available both for 32bit and 64bit version of Cygwin

https://sourceware.org/pipermail/cygwin-announce/2019-December/009360.html

$ cygcheck -cd |grep qhull
libqhull-devel                          2019.1-1
libqhull_7                              2019.1-1
qhull                                   2019.1-1

the import shared libraries are in the usual place

$ cygcheck -l libqhull-devel |grep dll
/usr/lib/libqhull.dll.a
/usr/lib/libqhull_p.dll.a
/usr/lib/libqhull_r.dll.a

as the include

$ cygcheck -l libqhull-devel |grep include

/usr/include/libqhull/DEPRECATED.txt
/usr/include/libqhull/geom.h
/usr/include/libqhull/index.htm
...
/usr/include/libqhullcpp/Coordinates.h
/usr/include/libqhullcpp/functionObjects.h
...
/usr/include/libqhull_r/geom_r.h
/usr/include/libqhull_r/index.htm
...
/usr/include/libqhull_r/user_r.h