c++ - OS X compile error: ld: symbol(s) not found for architecture x86_64 -


new compiling here, bear me. i'm trying compile c++ code on os x 10.10.3 using make. have xcode 6.3.1 installed. makefile generated using qmake. compiler runs until tries run final build command , throws error:

undefined symbols architecture x86_64:   "_iconv", referenced from:       puntoexe::charsetconversioniconv::myiconv(void*, char*, unsigned long) const in charsetconversioniconv.o   "_iconv_close", referenced from:       puntoexe::charsetconversioniconv::close() in charsetconversioniconv.o   "_iconv_open", referenced from:       puntoexe::charsetconversioniconv::initialize(int) in charsetconversioniconv.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [dicom2jpeg.app/contents/macos/dicom2jpeg] error 1 

i have found multiple threads here describing similar problem, , apparently comes down compiler linking 32 bit library. main suggestion works others add following code makefile:

-stdlib=libstdc++ 

the qmake-generated makefile looks this:

cc            = clang cxx           = clang++ defines       = -dqt_no_debug cflags        = -pipe -mmacosx-version-min=10.7 -o2 -arch x86_64 -wall -w $(defines) cxxflags      = -pipe -stdlib=libc++ -mmacosx-version-min=10.7 -o2 -arch x86_64 -wall -w $(defines) incpath       = -i/usr/local/cellar/qt/4.8.6/mkspecs/unsupported/macx-clang-libc++ -i. -i/usr/local/cellar/qt/4.8.6/include -i. link          = clang++ lflags        = -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -arch x86_64 libs          = $(sublibs)  -l/usr/local/cellar/qt/4.8.6/lib -lpthread 

so, i've changed makefile link appropriate library:

cc            = clang cxx           = clang++ defines       = -dqt_no_debug cflags        = -pipe -mmacosx-version-min=10.7 -o2 -arch x86_64 -wall -w $(defines) cxxflags      = -pipe -stdlib=libstdc++ -mmacosx-version-min=10.7 -o2 -arch x86_64 -wall -w $(defines) incpath       = -i/usr/local/cellar/qt/4.8.6/mkspecs/unsupported/macx-clang-libc++ -i. -i/usr/local/cellar/qt/4.8.6/include -i. link          = clang++ lflags        = -headerpad_max_install_names -stdlib=libstdc++ -mmacosx-version-min=10.7 -arch x86_64 libs          = $(sublibs)  -l/usr/local/cellar/qt/4.8.6/lib -lpthread 

but, no dice. still throwing same error on final build. missing something?


Comments