I just started using a 64-bit Mac Pro with Mac OS X Lion 10.7.1 and I can't seem to compile any c/c++ code that uses external libraries. I downloaded and built Googles libkml and also a file writing package called hdf5. Both are apparently built properly (the example code even works for the libkml stuff?!?), but when I try to write a simple program that includes the necessary libraries, I get an error like this:
My code is very simple:
where hdf5.h is a header file that came with the hdf5 package. I have tried adding options like -m64 and others, but nothing seems to work. What boggles my mind is that when I built libkml (different from the example I give above), the example programs that were compiled with the build actually work; however if I copy and paste them to my own directory they give me the same error message given above.
Any help/guidance/wisdom would be greatly appreciated. Thanks,
Nate
Code:
bash-3.2$ gcc -I /opt/local/include hdf5test.cc -o hdf5test
Undefined symbols for architecture x86_64:
"_H5check_version", referenced from:
_main in ccLZ5OT5.o
"_H5Fcreate", referenced from:
_main in ccLZ5OT5.o
"_H5Fclose", referenced from:
_main in ccLZ5OT5.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
My code is very simple:
Code:
#include "hdf5.h"
#define FILE "file.h5"
int main()
{
hid_t file_id; // file identifier
herr_t status;
file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
status = H5Fclose(file_id);
return 0;
}
where hdf5.h is a header file that came with the hdf5 package. I have tried adding options like -m64 and others, but nothing seems to work. What boggles my mind is that when I built libkml (different from the example I give above), the example programs that were compiled with the build actually work; however if I copy and paste them to my own directory they give me the same error message given above.
Any help/guidance/wisdom would be greatly appreciated. Thanks,
Nate