You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenCV need import <opencv2/opencv.hpp> before others import。
#if defined(NO)
# warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
#endif
But prefix_header not supported generate prefix_header_file foremost.
So I fix it in Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "13.0"
end
end
# 插入这一句,解决OpenCV编译报错
prefix_pch_path = 'Pods/Target Support Files/LPOpenCV/LPOpenCV-prefix.pch'
if File.exist?(prefix_pch_path)
content_to_add = <<-OPEN_CV_HEADER
// ↓ --- 解决OpenCV的问题:warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#import <opencv2/imgproc/types_c.h>
#import <opencv2/core.hpp>
#import <opencv2/features2d.hpp>
#import <opencv2/calib3d.hpp>
#import <opencv2/objdetect.hpp>
#import <opencv2/highgui.hpp>
#import <opencv2/imgproc.hpp>
#import <opencv2/objdetect/objdetect.hpp>
#endif
// ↑ ---
OPEN_CV_HEADER
File.open(prefix_pch_path, 'r ') do |file|
old_content = file.read
file.rewind
file.puts content_to_add old_content
end
end
end
Could you exchange prefix_header_file generated order with prefix_header.rb?
def generate
result = super
unique_prefix_header_contents = file_accessors.map do |file_accessor|
file_accessor.spec_consumer.prefix_header_contents
end.compact.uniq
unique_prefix_header_contents.each do |prefix_header_contents|
result << prefix_header_contents
result << "\n"
end
file_accessors.map(&:prefix_header).compact.uniq.each do |prefix_header|
result << Pathname(prefix_header).read
end
result
end
↓
def generate
result = ""
unique_prefix_header_contents = file_accessors.map do |file_accessor|
file_accessor.spec_consumer.prefix_header_contents
end.compact.uniq
unique_prefix_header_contents.each do |prefix_header_contents|
result << prefix_header_contents
result << "\n"
end
file_accessors.map(&:prefix_header).compact.uniq.each do |prefix_header|
result << Pathname(prefix_header).read
end
result << super
result
end
The text was updated successfully, but these errors were encountered:
Code: prefix_header.rb
OpenCV need
import <opencv2/opencv.hpp>
before others import。But prefix_header not supported generate
prefix_header_file
foremost.So I fix it in Podfile
Could you exchange
prefix_header_file
generated order with prefix_header.rb?↓
The text was updated successfully, but these errors were encountered: