I want to share with you one trick about hdf4. If you are compiling/ linking using both libmfhdf.a and libdf.a, be sure to put "-lmfhdf" in front of "-ldf" in your command line. If instead you put "-df" in front of "-lmfhdf", you may get errors like yours.
Please try if this helps for your problem. It took me a while to figure out this trick. But I still do not know why. ----- Original Message ----- From: "tomhagen1989" <[email protected]> To: [email protected] Sent: Monday, November 14, 2011 5:25:12 AM Subject: [Hdf-forum] error when compiling c program with hdf4 /tmp/cc3jfEvc.o: In function `inputfield': spectralmpi.c:(.text+0x44): undefined reference to `SDstart' spectralmpi.c:(.text+0x56): undefined reference to `SDselect' spectralmpi.c:(.text+0xc2): undefined reference to `SDreaddata' spectralmpi.c:(.text+0x146): undefined reference to `SDend' /tmp/cc3jfEvc.o: In function `Init': spectralmpi.c:(.text+0x926): undefined reference to `SDstart' spectralmpi.c:(.text+0x95e): undefined reference to `SDselect' spectralmpi.c:(.text+0x99a): undefined reference to `SDgetinfo' spectralmpi.c:(.text+0x9f0): undefined reference to `SDend' /tmp/cc3jfEvc.o: In function `outputfield': spectralmpi.c:(.text+0x3071): undefined reference to `DFR8addimage' spectralmpi.c:(.text+0x3142): undefined reference to `SDstart' spectralmpi.c:(.text+0x316a): undefined reference to `SDcreate' spectralmpi.c:(.text+0x31ad): undefined reference to `SDsetcompress' spectralmpi.c:(.text+0x3204): undefined reference to `SDwritedata' spectralmpi.c:(.text+0x3211): undefined reference to `SDendaccess' spectralmpi.c:(.text+0x321e): undefined reference to `SDend' spectralmpi.c:(.text+0x32d5): undefined reference to `SDwritedata' spectralmpi.c:(.text+0x32e2): undefined reference to `SDendaccess' spectralmpi.c:(.text+0x32ef): undefined reference to `SDend' spectralmpi.c:(.text+0x33df): undefined reference to `SDstart' spectralmpi.c:(.text+0x33f6): undefined reference to `SDnametoindex' spectralmpi.c:(.text+0x3408): undefined reference to `SDselect' spectralmpi.c:(.text+0x3498): undefined reference to `SDwritedata' spectralmpi.c:(.text+0x34a5): undefined reference to `SDendaccess' spectralmpi.c:(.text+0x34b2): undefined reference to `SDend' /tmp/cc3jfEvc.o: In function `plot': spectralmpi.c:(.text+0x362a): undefined reference to `SDstart' spectralmpi.c:(.text+0x363d): undefined reference to `SDend' spectralmpi.c:(.text+0x37b3): undefined reference to `SDstart' spectralmpi.c:(.text+0x385f): undefined reference to `SDcreate' spectralmpi.c:(.text+0x3891): undefined reference to `SDwritedata' spectralmpi.c:(.text+0x38a4): undefined reference to `SDendaccess' spectralmpi.c:(.text+0x391a): undefined reference to `SDcreate' spectralmpi.c:(.text+0x394c): undefined reference to `SDwritedata' spectralmpi.c:(.text+0x395f): undefined reference to `SDendaccess' spectralmpi.c:(.text+0x3972): undefined reference to `SDend' collect2: ld returned 1 exit status Have I installed hdf4 wrong? -- View this message in context: http://hdf-forum.184993.n3.nabble.com/error-when-compiling-c-program-with-hdf4-tp3506544p3506544.html Sent from the hdf-forum mailing list archive at Nabble.com. _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
