Clion编译 报错 “wchar .h not found” “string .h not found”

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Clion编译 报错 “wchar .h not found” “string .h not found”相关的知识,希望对你有一定的参考价值。

参考技术A 升级到macos 10.14系统后,发现clion在编译时提示了一堆系统头文件找不到的错误,诸如此类:

“wchar .h not found”

“string .h not found”

即使在项目录上点击右键,选择“Reload cmake project”也不管用。

解决方案1:

在菜单栏点击: “Tools -> CMake -> ResetCache and Reload Project”

解决方案2:

删除项目目录中的 “cmake-build-debug”目录

重新用clion打开项目,在项目录上点击右键,选择“Reload cmake project”

Mac(m1) clion编译opencv报错building for macOS-x86_64 but attempting to link with file built for macOS-ar

代码如下:

 

 

具体报错如下:

ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_dnn.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_video.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_datasets.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_videoio.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_objdetect.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_imgcodecs.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_imgproc.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_flann.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_calib3d.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_photo.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64ld: warning: ignoring file /opt/homebrew/opt/opencv@3/lib/libopencv_features2d.3.4.16.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

解决办法:

在cmake中添加编译选项:

 

以上是关于Clion编译 报错 “wchar .h not found” “string .h not found”的主要内容,如果未能解决你的问题,请参考以下文章

BazelBazel项目编译报错:ERROR: bazel does not currently work properly from paths containing spaces

BazelBazel项目编译报错:ERROR: bazel does not currently work properly from paths containing spaces

clion编译jni,找不到jni.h的解决办法

clion莫名其妙的报错,请各位大神帮忙看下是啥原因

CPP小记:CLion for Mac报错Ignoring CMAKE_OSX_SYSROOT value,XCode not exist

# Clion中编译多个cpp(实现单文件编译)