Re: Ambiguous C++ symbols


On Aug 13, 2020, at 6:16 PM, Glenn L. Austin <glenn@...> wrote:

namespace OpenCV {
#import "opencv/header.h"

To use:

result = OpenCV::opencvAPI(parameters)

Uh … that won't help, just cause link errors — declaring the OpenCV API as being in an OpenCV namespace doesn't change the fact that the implementation isn't in that namespace*. So the code will be calling OpenCV::cv::Foo, but the actual function is named cv::Foo.

The issue seems to be that the source file has a "using namespace opencv" declaration, so all the OpenCV types get dumped into the global namespace where they can conflict with C symbols. The fix is not to do that — just bite the bullet and type "cv::Foo" instead of "Foo".


* Kind of like the old joke "Q: How many legs does a dog have, if you call a talk a leg? A: Four. Calling it a leg doesn't make it one."

Join to automatically receive all group messages.