before this gets flagged as a repeat question please read the end. Thanks for looking.
I set up openCV using home-brew.
These were the commands I used:
My problem was that brew compiled and linked with Xcode, and I was using a different version of g++ from macports. I just added the Xcode g++ location to my $PATH variable in my .bash_profile file and unlinked the wrong g++ binary with sudo port select --set gcc none. You can find the Xcode g++ location by running xcodebuild -find g++, mine was /Applications/Xcode.app/Contents/Developer/usr/bin/g++.