Some Boring Warning

本文探讨了在iOS开发过程中遇到的三个常见警告:函数原型缺失、隐式函数声明和不兼容指针类型错误,并提供了相应的解决方案。通过设置BuildSettings、引入头文件或进行类型转换,开发者可以有效消除这些警告,提升代码质量和开发效率。
今天打开一个项目的时候看到了的几个警告:

“No previous prototype for function”
缺少函数原型,网上查了些资料,有两个解决方案:

1.在Build Settings里找到“Missing Function Prototypes”,默认设置为YES,将它设为NO,这样做Xcode就会忽略这个警告,不再显示。关于Xcode为什么会有这么个警告, stackoverflow 上有这方面的讨论,可以了解一下。

2.在函数前加一个static。这样做也可以去除警告,不过还是很担心这样做会不会不妥,能力有限,就不深究了,冏~

Implicit declaration of function  'CC_MD5' is invalid in C99”
隐式声明了函数,可能是是没有引入函数定义的头文件。
比如我的警告是“Implicit declaration of function 'CC_MD5' is invalid in C99”,在文件开头加入
#import <CommonCrypto/CommonDigest.h>即可。

“Incompatible pointer types assigning to 'NSHTTPURLResponse *' from 'NSURLResponse *' 不兼容的指针类型,在我的项目中,NSURLResponse是NSHTTPURLResponse的父类,所以不能直接将NSURLResponse赋给NSHTTPURLRespons。简单的办法是强制转换,如    
response = (NSHTTPURLResponse *)[aResponse retain];
做的周密一点的话,可以做好判断,输出error等。

参考链接:http://stackoverflow.com/questions/12200238/ios-2-duplicate-symbols-for-architecture-armv7
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting cryptography Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d6/0d/d13399c94234ee8f3df384819dc67e0c5ce215fb751d567a55a1f4b028c7/cryptography-45.0.6.tar.gz (744 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: cffi>=1.14 in d:\desktop\乐骐编程\python 3.13.5\lib\site-packages (from cryptography) (1.17.1) Requirement already satisfied: pycparser in d:\desktop\乐骐编程\python 3.13.5\lib\site-packages (from cffi>=1.14->cryptography) (2.22) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for cryptography (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [189 lines of output] Running `maturin pep517 build-wheel -i D:\Desktop\乐骐编程\python 3.13.5\python3.13t.exe --compatibility off` 馃嵐 Building a mixed python/rust project 馃敆 Found pyo3 bindings with abi3 support 馃悕 Found CPython 3.13t at D:\Desktop\涔愰獝缂栫▼\python 3.13.5\python3.13t.exe 馃摗 Using build options locked from pyproject.toml 鈿狅笍 Warning: CPython 3.13t at D:\Desktop\涔愰獝缂栫▼\python 3.13.5\python3.13t.exe does not yet support abi3 so the build artifacts will be version-specific. Compiling target-lexicon v0.13.2 Compiling proc-macro2 v1.0.95 Compiling unicode-ident v1.0.18 Compiling shlex v1.3.0 Compiling once_cell v1.21.3 Compiling vcpkg v0.2.15 Compiling pkg-config v0.3.32 Compiling libc v0.2.172 Compiling cc v1.2.23 Compiling openssl v0.10.72 Compiling autocfg v1.4.0 Compiling foreign-types-shared v0.1.1 Compiling bitflags v2.9.1 Compiling foreign-types v0.3.2 Compiling heck v0.5.0 Compiling cfg-if v1.0.0 Compiling memoffset v0.9.1 Compiling itoa v1.0.15 Compiling indoc v2.0.6 Compiling cryptography-key-parsing v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-0123deo6\cryptography_e5bbb418237444258d9bf4a8bed71109\src\rust\cryptography-key-parsing) Compiling unindent v0.2.4 Compiling pyo3-build-config v0.25.0 Compiling cryptography-openssl v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-0123deo6\cryptography_e5bbb418237444258d9bf4a8bed71109\src\rust\cryptography-openssl) Compiling quote v1.0.40 Compiling base64 v0.22.1 Compiling self_cell v1.2.0 Compiling syn v2.0.101 Compiling pem v3.0.5 Compiling openssl-sys v0.9.108 Compiling cryptography-cffi v0.1.0 (C:\Users\awei006\AppData\Local\Temp\pip-install-0123deo6\cryptography_e5bbb418237444258d9bf4a8bed71109\src\rust\cryptography-cffi) warning: openssl-sys@0.9.108: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information. error: failed to run custom build command for `openssl-sys v0.9.108` Caused by: process didn't exit successfully: `C:\Users\awei006\AppData\Local\Temp\pip-install-0123deo6\cryptography_e5bbb418237444258d9bf4a8bed71109\target\release\build\openssl-sys-81bfb0a89f2ad101\build-script-main` (exit code: 101) --- stdout cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS", "OPENSSL_NO_RC2")) cargo:rustc-check-cfg=cfg(openssl) cargo:rustc-check-cfg=cfg(libressl) cargo:rustc-check-cfg=cfg(boringssl) cargo:rustc-check-cfg=cfg(awslc) cargo:rustc-check-cfg=cfg(libressl250) cargo:rustc-check-cfg=cfg(libressl251) cargo:rustc-check-cfg=cfg(libressl252) cargo:rustc-check-cfg=cfg(libressl261) cargo:rustc-check-cfg=cfg(libressl270) cargo:rustc-check-cfg=cfg(libressl271) cargo:rustc-check-cfg=cfg(libressl273) cargo:rustc-check-cfg=cfg(libressl280) cargo:rustc-check-cfg=cfg(libressl281) cargo:rustc-check-cfg=cfg(libressl291) cargo:rustc-check-cfg=cfg(libressl310) cargo:rustc-check-cfg=cfg(libressl321) cargo:rustc-check-cfg=cfg(libressl332) cargo:rustc-check-cfg=cfg(libressl340) cargo:rustc-check-cfg=cfg(libressl350) cargo:rustc-check-cfg=cfg(libressl360) cargo:rustc-check-cfg=cfg(libressl361) cargo:rustc-check-cfg=cfg(libressl370) cargo:rustc-check-cfg=cfg(libressl380) cargo:rustc-check-cfg=cfg(libressl381) cargo:rustc-check-cfg=cfg(libressl382) cargo:rustc-check-cfg=cfg(libressl390) cargo:rustc-check-cfg=cfg(libressl400) cargo:rustc-check-cfg=cfg(libressl410) cargo:rustc-check-cfg=cfg(ossl101) cargo:rustc-check-cfg=cfg(ossl102) cargo:rustc-check-cfg=cfg(ossl102f) cargo:rustc-check-cfg=cfg(ossl102h) cargo:rustc-check-cfg=cfg(ossl110) cargo:rustc-check-cfg=cfg(ossl110f) cargo:rustc-check-cfg=cfg(ossl110g) cargo:rustc-check-cfg=cfg(ossl110h) cargo:rustc-check-cfg=cfg(ossl111) cargo:rustc-check-cfg=cfg(ossl111b) cargo:rustc-check-cfg=cfg(ossl111c) cargo:rustc-check-cfg=cfg(ossl111d) cargo:rustc-check-cfg=cfg(ossl300) cargo:rustc-check-cfg=cfg(ossl310) cargo:rustc-check-cfg=cfg(ossl320) cargo:rustc-check-cfg=cfg(ossl330) cargo:rustc-check-cfg=cfg(ossl340) cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR Could not find openssl via pkg-config: Could not run `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl` The pkg-config command could not be found. Most likely, you need to install a pkg-config package for your OS. If you've already installed it, ensure the pkg-config command is one of the directories in the PATH environment variable. If you did not expect this build to link to a pre-installed system library, then check documentation of the openssl-sys crate for an option to build the library from source, or disable features or dependencies that require pkg-config. note: vcpkg did not find openssl: the vcpkg-rs Vcpkg build helper can only find libraries built for the MSVC ABI. cargo:warning=Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. See stderr section below for further information. --- stderr Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-pc-windows-gnu $TARGET = x86_64-pc-windows-gnu openssl-sys = 0.9.108 It looks like you're compiling for MinGW but you may not have either OpenSSL or pkg-config installed. You can install these two dependencies with: pacman -S openssl-devel pkgconf and try building this crate again. warning: build failed, waiting for other jobs to finish... 馃挜 maturin failed Caused by: Failed to build a native library through cargo Caused by: Cargo build finished with "exit code: 101": `"cargo" "rustc" "--message-format" "json-render-diagnostics" "--locked" "--manifest-path" "C:\\Users\\awei006\\AppData\\Local\\Temp\\pip-install-0123deo6\\cryptography_e5bbb418237444258d9bf4a8bed71109\\src\\rust\\Cargo.toml" "--release" "--lib"` Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'D:\\Desktop\\乐骐编程\\python 3.13.5\\python3.13t.exe', '--compatibility', 'off'] returned non-zero exit status 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cryptography Failed to build cryptography error: failed-wheel-build-for-install × Failed to build installable wheels for some pyproject.toml based projects ╰─> cryptography
08-29
【故障诊断】【pytorch】基于CNN-LSTM故障分类的轴承故障诊断研究[西储大学数据](Python代码实现)内容概要:本文介绍了基于CNN-LSTM神经网络模型的轴承故障分类方法,利用PyTorch框架实现,采用西储大学(Case Western Reserve University)公开的轴承故障数据集进行实验验证。该方法结合卷积神经网络(CNN)强大的特征提取能力和长短期记忆网络(LSTM)对时序数据的建模优势,实现对轴承不同故障类型和严重程度的高精度分类。文中详细阐述了数据预处理、模型构建、训练流程及结果分析过程,并提供了完整的Python代码实现,属于典型的工业设备故障诊断领域深度学习应用研究。; 适合人群:具备Python编程基础和深度学习基础知识的高校学生、科研人员及工业界从事设备状态监测与故障诊断的工程师,尤其适合正在开展相关课题研究或希望复现EI级别论文成果的研究者。; 使用场景及目标:① 学习如何使用PyTorch搭建CNN-LSTM混合模型进行时间序列分类;② 掌握轴承振动信号的预处理与特征学习方法;③ 复现并改进基于公开数据集的故障诊断模型,用于学术论文撰写或实际工业场景验证; 阅读建议:建议读者结合提供的代码逐行理解模型实现细节,重点关注数据加载、滑动窗口处理、网络结构设计及训练策略部分,鼓励在原有基础上尝试不同的网络结构或优化算法以提升分类性能。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值