From: JonY <jo...@us...> - 2010-01-09 17:13:29
|
On 1/10/2010 00:48, LRN wrote: > $ nm -A --defined-only /mingw/lib/*.a | grep lt_dlopenext > %DISK_WITH_MINGW%/mingw/lib/libltdl.a:libltdl_libltdl_la-ltdl.o:00003130 > T _lt_dlopenext > %DISK_WITH_MINGW%/mingw/lib/libltdl.dll.a:d000063.o:00000000 I > __imp__lt_dlopenext > %DISK_WITH_MINGW%/mingw/lib/libltdl.dll.a:d000063.o:00000000 T _lt_dlopenext > > $ gcc -o conftest.exe -g -O2 -lltdl conftest.c > %TEMP%\ccwyr3xI.o: In function `main': > %CURRENT_DIRECTORY%/conftest.c:33: undefined reference to `lt_dlopenext' > collect2: ld returned 1 exit status > > $ cat conftest.c > /* confdefs.h */ > #define PACKAGE_NAME "GNUnet" > #define PACKAGE_TARNAME "gnunet" > #define PACKAGE_VERSION "0.8.1" > #define PACKAGE_STRING "GNUnet 0.8.1" > #define PACKAGE_BUGREPORT "bug...@gn..." > #define PACKAGE_URL "" > #define PACKAGE "GNUnet" > #define VERSION "0.8.1" > #define STDC_HEADERS 1 > #define HAVE_SYS_TYPES_H 1 > #define HAVE_SYS_STAT_H 1 > #define HAVE_STDLIB_H 1 > #define HAVE_STRING_H 1 > #define HAVE_MEMORY_H 1 > #define HAVE_STRINGS_H 1 > #define HAVE_INTTYPES_H 1 > #define HAVE_STDINT_H 1 > #define HAVE_UNISTD_H 1 > #define LT_OBJDIR ".libs/" > /* end confdefs.h. */ > > /* Override any GCC internal prototype to avoid an error. > Use char because int might match the return type of a GCC > builtin and then its argument prototype would still apply. */ > #ifdef __cplusplus > extern "C" > #endif > char lt_dlopenext (); > int > main () > { > return lt_dlopenext (); > ; > return 0; > } > > What's wrong with it? > Hi, Its failing because of the wrong link order. Libraries are always specified after the objects. Wrong: gcc -o conftest.exe -g -O2 -lltdl conftest.c Correct: gcc -o conftest.exe -g -O2 conftest.c -lltdl |