Reputation: 6952
I'm building my iOS project with linking errors. My project links against some third-party static libraries. They use different standard c++ library, one is libstdc++
, the other is libc++
.
Link against either one will cause the linking errors in other lib, so I link both of them in my target, the command line is -lstdc++ -lc++
.
Now it build successfully, but I wonder if it will cause some runtime error, can anybody explain about this ? Thanks in advance.
Upvotes: 3
Views: 196
Reputation: 249333
No, it is not safe. In fact, it is a direct violation of the One Definition Rule (ODR). The ODR says, among other things, that you can have at most one definition of any non-inline function in an entire program. You will violate this rule by linking two different implementations of the standard library.
Upvotes: 4