C++ Linking Error After Upgrading to MAC Os X 10.9/Xcode 5.0.1

C++ linking error after upgrading to Mac OS X 10.9 / Xcode 5.0.1

The answer is there: https://mathematica.stackexchange.com/questions/34692/mathlink-linking-error-after-os-x-10-9-mavericks-upgrade

There are two implementations of the standard C++ library available on OS X: libstdc++ and libc++. They are not binary compatible and libMLi3 requires libstdc++.

On 10.8 and earlier libstdc++ is chosen by default, on 10.9 libc++ is chosen by default. To ensure compatibility with libMLi3, we need to choose libstdc++ manually.

To do this, add -stdlib=libstdc++ to the linking command.

Related post: Compiling with Clang using Libc++ undefined references


Edit: After some investigations it seems there is a link between the -mmacosx-version-min and the choice of the default libstd. If min version < 10.9, then the default libstd is equal to libstdc++, else to libc++. The long term solution is clearly to use -stdlib=libc++

ACE fails at Linker in MAC OS X 10.9 (and higher)

Thanks for the replies, after some investigation on Linux Ubuntu, I succeeded to compile the code with the following command g++ -o m.out myTest.cpp ACE_wrappers/lib/libACE.a -I ACE_wrappers/ -lpthread -ldl. Seems some default libs were missing!

Error compiling using stdlibc++ - symbol(s) not found for architecture x86_64

I figured it out. Since I am running on Mac, g++ needs this flag -undefined dynamic_lookup

Makefile does not work on mac os x Mavericks

I doubt this makefile ever worked, unless somehow the new version of MacOSX has moved those headers out of the standard location into a different location.

You are using the default built-in rules, as Paul R says, but you are not using the default make variables that go with those rules. I would write my makefile like this:

CXX = g++
CXXFLAGS = -O2 -g -Wall -fmessage-length=0
CPPFLAGS = -I/usr/local/Cellar/opencv/2.4.6.1/include

OBJS = Hello.o

LDFLAGS = -L/usr/local/Cellar/opencv/2.4.6.1/lib
LDLIBS = -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video \
-lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect \
-lopencv_contrib -lopencv_legacy -lopencv_gpu

TARGET = Hello

.PHONY: all
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@

.PHONY: clean
clean:
rm -f $(OBJS) $(TARGET)

Undefined symbol “toupper” in MacPorts GCC 4.7 OS-X Mavericks 10.9 C11

There's a patch in http://trac.macports.org/ticket/41033
It solved my problem.
You just have to patch the file in /usr/include/sys/cdefs.h and replace

#elif defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)

by

#elif defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) && !defined(__cplusplus)

Good luck.



Related Topics



Leave a reply



Submit