[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To compile the example program on a Unix system, we can say:
cc -o psamples psamples.c -lwfdb |
to produce an executable program called psamples
. (Your C
compiler may be named `gcc', `acc', `CC', or something
else, rather than `cc', but under any version of Unix, it will
almost certainly work as shown above.) You may use any other compiler
options you choose, but the `-lwfdb' option must appear in the
cc
command line following any and all source (`*.c') and
object (`*.o') file names, in order to instruct the loader to
search the WFDB library for any functions that the program needs (in
this case, isigopen
and getvec
). Some programs will need
additional libraries, and the corresponding `-l' options can
usually be given before or after the `-lwfdb' option.
If the WFDB library was installed with NETFILES support, it will make use of
functions contained in the libcurl
or libwww
libraries. If you
have dynamically linkable versions of the libcurl
or libwww
libraries, as under GNU/Linux, these will be loaded automatically when you run
psamples
. If you have only static versions of these libraries, as under
Solaris or MS-Windows, however, it is necessary to provide additional arguments
in the cc
command line in order to compile successfully. One way to do
this is to follow the model used to compile the standard WFDB applications
supplied with the WFDB library; see `Makefile' in the `app' directory
of the WFDB software package source tree.
If you are using WFDB version 10.2.6 or a later version and `gcc'
or a compatible compiler, the `wfdb-config' utility is available
to help construct commands for compiling programs that use the WFDB
library (and the libcurl
or libwww
libraries, if available).
Use it like this:
gcc `wfdb-config --cflags` -o psamples psamples.c `wfdb-config --libs` |
Note that this command contains backticks (`), not apostrophes (').
`wfdb-config' is particularly useful if the WFDB library or
its `*.h' files are installed in non-standard locations, or if
you have only static libcurl
or libwww
libraries.
Under MS-Windows, it will be easiest to use `gcc', the GNU C/C++ compiler, which is included in the freely available Cygwin software development system (http://www.cygwin.com/), and also in the freely available MinGW package (http://www.mingw.org/). An MS-DOS version of `gcc' is available in the free djgpp package (http://www.delorie.com/djgpp/). These are used within a Cygwin terminal emulator window or an MS-DOS box in exactly the same way as described above for Unix C compilers.
The WFDB library is developed and tested using gcc
, but careful
attention has been given to making it usable with any K&R or ANSI/ISO C
compiler. Note, however, that binary versions of the WFDB library that
have been compiled using gcc
are not compatible with most
proprietary C/C++ compilers (except under Unix). Since gcc
is
free, high quality, and supported, it is highly recommended that you
use it for compiling your WFDB applications.
If you choose to use an incompatible proprietary compiler, you are on your own! You may be able to create a linkable version of the WFDB library from the sources in the `lib' directory of the WFDB source tree using a proprietary compiler, but doing so is unsupported (see your compiler's documentation, and if you are using MS-DOS or MS-Windows, see `Makefile.dos' for hints). If you are not able to build the WFDB library using your compiler, you can compile the library sources together with the source file(s) for your application. It may be easiest to copy the library sources (both the `*.c' and the `*.h' files) into the same directory as the application sources. If you follow this approach, find the directory that contains `stdio.h' on your system and make a `wfdb' subdirectory within that directory, then copy the WFDB library's `*.h' files into the `wfdb' subdirectory (this is necessary so that statements of the form `#include <wfdb/wfdb.h>' will be handled properly by your compiler). For example, to compile `psamples.c' with Microsoft C/C++, set up the WFDB library source files as just described, then use this command:
cl psamples.c wfdbio.c signal.c annot.c calib.c wfdbinit.c |
With Borland C/C++ or Turbo C or C++, substitute `bcc' or `tcc', respectively, for `cl' in the command above. You will find that some WFDB applications do not need to be compiled with all of the WFDB library sources (for example, `psamples' needs only `wfdbio.c' and `signal.c'); in such cases, you may omit the unneeded sources for faster compilation and smaller executable binaries.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |