tags:

views:

556

answers:

3

I have this code:

#include <iostream>
#include <mp4.h>

int main (int argc, char * const argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";

    MP4Read("filename", MP4_DETAILS_ALL );

    return 0;
}

And i've added -I/opt/local/include and -L/opt/local/lib to the path (where the mp4 library resides after installing it through macports), but all i get is:

Undefined symbols: "_MP4Read", referenced from: _main in main.o ld: symbol(s) not found

Even though XCode finds it and autocompletes properly...

+7  A: 

You need to link the library most likely, i.e. add -lmp4 or similar to your linking commands.

antti.huima
+2  A: 

You have only specified the paths. You need to link in the mp4 library. Something like the following:

g++ -I /.../ -L /.../ -lmp4 -o out main.cpp
dirkgently
A: 

The -L flags tell the compiler where to look, the -l flag tells it what to look for.

anon