Next: , Up: Writing applications

9.1 Including libraries and linking

To use any marsyas code in your program(s), you need to include the Marsyas libraries in your project.

9.1.1 ... using qmake

The easiest way to compile Marsyas programs is to use qmake. You may do this even if you used autotools to configure Marsyas itself; the author of this documentation uses autotools to build Marsyas, and qmake to build his programs.

Create a file:

#  your files
SOURCES = my_program_name.cpp
#HEADERS += extra_file.h
#SOURCES += extra_file.cpp

### if running inside the source tree
### adjust as necessary:

### if installed elsewhere

### basic OS stuff; do not change!
win32-msvc2005:LIBS += marsyas.lib
unix:LIBS += -lmarsyas -L$$MARSYAS_INSTALL_DIR/lib
!macx:LIBS += -lasound
macx:LIBS += -framework CoreAudio -framework CoreMidi -framework CoreFoundation

Then type qmake to generate a Makefile. Now you many compile normally.

9.1.2 ... writing your own Makefile

We highly recommend that you use qmake to create a Makefile. However, if you enjoy swearing at your computer and cursing k&r, rms, gnu, and every other three-letter programmer acronym in existence, go ahead. read on.

Here are sample Makefiles to get you started:



9.1.3 ... on Windows Visual Studio

Create the .cpp and .h files you will be working with in the project. Don't worry about the VS project file, it will be generated by qmake.

Type qmake -project at the command line to generate the .pro file, which Qt uses to create the Makefile (or you can make your own as above). Don't worry about linking to external libraries, we will take care of that in Visual Studio.

Once you have a .pro file, type

     qmake -tp vc -spec win32-msvc2008

Or equivalent based on your system. This will generate a .vcproj file. Open this in Visual Studio.

Navigate to Tools->Options->Projects and Solutions->VC++ Directories and ensure:

These settings worked for the author.