Reputation: 752
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...
Upvotes: 0
Views: 1531
Reputation:
The -L flags tell the compiler where to look, the -l flag tells it what to look for.
Upvotes: 1
Reputation: 111150
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
Upvotes: 3
Reputation: 25532
You need to link the library most likely, i.e. add -lmp4 or similar to your linking commands.
Upvotes: 8