OpenCV Parse Issue

Currently I am trying to implement OpenCV into my Swift app and when I go to build the project I get a parse issue. It says there is an expected identifier in files "exposure_compensate.hpp" and "blenders.hpp". To implement OpenCV I have created a bridge-header and an Objective-C wrapper for OpenCV's C++ code just like you're supposed to. The compiler says that it is failing because it detected a macro "NO" definition during the build but I have no idea what could be causing it to do that. One source suggested that I include a prefix.pch file to my project but I don't know how to point Swift to the prefix.pch file. Any suggestions on what I should do? Any help would be appreciated.

Same here...😐

I've added opencv as follows

  1. Download it and build it
    git clone https://github.com/opencv/opencv
    cd opencv
    mkdir build && cd build
    cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=../install ..
    sudo make -j$(sysctl -n hw.logicalcpu)
    sudo make install
    
  2. Go to install
  3. Copy all .a files from lib and lib/opencv4/3rdparty/ into your project. I.e. MyProject/Libraries/
  4. Get to install/include/opencv4/ and copy the opencv2 folder into your project.
  5. Go to your project settings Targets -> Search Paths -> Header Search Paths
  6. Add the following path $(PROJECT_DIR)/Path/to/opencv2/

NOTE: I currently have a problem with my Xcode and I guess it's related to opencv, so you may also encounter this issue.

Ryan

OpenCV Parse Issue
 
 
Q