4

I'm using Mac 10.10 and OpenCV 3.0, when I was compiling my project I got this error:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After that, I changed the c++ standard library to libstdc++, another error appeared:

/usr/local/include/opencv2/hal/defs.h:271:14: 'cstdint' file not found

Hope someone could help me

Dennis Do
  • 480
  • 7
  • 24
  • Please let me know if you solved the issue. I am having same one. – Hoon Oct 29 '15 at 01:06
  • I'm really sorry, I don't remember how to fix it. I guess it may be caused by xcode compiler. My Mac has been reinstalled, so I followed this tutorial and it works for me http://mac-opencv-projects.blogspot.com/2014/01/installing-opencv-on-mac-os-x-1091.html – Dennis Do Nov 11 '15 at 20:16

2 Answers2

0

based on the top answer in this question, there are two ways to fix this problem regarding to this fact that you are using of macOs and your default compiler is Clang. You can use:

#include <tr1/cstdint>

or

#include <stdint.h>

instead of cstdint, that is a part of libc++.

Community
  • 1
  • 1
Amin Abouee
  • 41
  • 2
  • 5
0

I hit this when trying to import a header (.h) that was written for C++ into some Objective C code (.m).

The solution for me was to create a middle-ground Objective C++ file (.mm) and header that that imported the C++ header and then exported c-compatible wrapper functions.

The header had something like this in it to make it play nice with Objective-C (.m) code

#if defined(__cplusplus)
extern "C" {
#endif

const char *MyNewFunction(void); // or whatever

#if defined(__cplusplus)
}
#endif

(Credit to Dave Hylands for helping me figure all of that out.)

Nathan Friedly
  • 7,837
  • 3
  • 42
  • 59