fatal run-time error. Press OK to close the program

本文记录了解决文件路径问题的过程,从中文路径无法使用到改用英文路径的成功经验,尝试了重装和导出导入asc文件但无效。

解决办法1:将文件存放的路径改为英文路径(成功了)

解决方法2:重装 (没用)

解决方法三:导出asc文件 重新导入(没用)

奇怪的是之前一直都是用中文的路径存放文件都可以,现在突然不行了

* Executing task in folder 04-key_control_led: C:\Users\playe\.platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM3 Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino) -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html PLATFORM: Espressif 32 (3.4.0) > Adafruit ESP32 Feather HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa) PACKAGES: - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) - tool-esptoolpy @ 1.30100.210531 (3.1.0) - tool-mkspiffs @ 2.230.0 (2.30) - toolchain-xtensa32 @ 2.50200.97 (5.2.0) LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 29 compatible libraries Scanning dependencies... No dependencies Building in release mode Retrieving maximum program size .pio\build\featheresp32\firmware.elf Checking size .pio\build\featheresp32\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [ ] 4.1% (used 13384 bytes from 327680 bytes) Flash: [== ] 15.4% (used 202362 bytes from 1310720 bytes) Configuring upload protocol... AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa CURRENT: upload_protocol = esptool Looking for upload port... Using manually specified: COM3 Uploading .pio\build\featheresp32\firmware.bin esptool.py v3.1 Serial port COM3 Connecting........_____....._____....._____....._____....._____....._____....._____ A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header *** [upload] Error 2 =================================================================== [FAILED] Took 26.61 seconds =================================================================== * The terminal process "C:\Users\playe\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--upload-port', 'COM3'" terminated with exit code: 1. * Terminal will be reused by tasks, press any key to close it.
最新发布
09-06
### 关于CVI运行代码关闭后出现fatal run-time error错误的原因及解决方案 在使用LabWindows/CVI(简称CVI)开发应用程序时,如果程序在关闭时出现“fatal run-time error”错误,通常是由以下几种原因引起的[^1]: #### 1. 资源未正确释放 程序中可能存在未正确释放的资源,例如文件句柄、动态分配的内存或图形界面组件等。当程序关闭时,这些未释放的资源可能导致运行时错误。确保所有动态分配的资源在程序退出前都被正确释放[^2]。 #### 2. 回调函数未正确清理 如果程序中定义了回调函数(如按钮点击事件、定时器事件等),但在程序退出时未正确注销这些回调函数,可能会导致运行时错误。需要确保在程序关闭前调用适当的函数来注销这些回调[^3]。 #### 3. 全局变量或静态变量未正确初始化或销毁 全局变量或静态变量可能在程序关闭时触发某些操作,例如析构函数或清理函数。如果这些操作依赖于已释放的资源或无效的状态,可能会引发致命错误。因此,需要检查全局变量和静态变量的生命周期管理[^4]。 #### 4. 线程未正确结束 如果程序中使用了多线程,并且某些线程在程序关闭时仍未正常结束,可能会导致运行时错误。确保在程序退出前,所有线程都已安全退出[^5]。 #### 解决方案示例代码 以下是一个简单的代码示例,展示如何在程序关闭时正确释放资源和清理回调函数: ```c #include <cvirte.h> /* CVI Run-Time Library Header */ #include <userint.h> /* User Interface Library Header */ void CleanupResources(void) { // 确保所有资源被正确释放 CloseAllFiles(); // 假设这是一个自定义函数,用于关闭所有打开的文件 FreeDynamicMemory(); // 假设这是一个自定义函数,用于释放动态分配的内存 } void UnregisterCallbacks(void) { // 注销所有回调函数 UnregisterButtonCallback(buttonID); // 假设buttonID是某个按钮的ID UnregisterTimerCallback(timerID); // 假设timerID是某个定时器的ID } int main(void) { if (LoadPanel(0, "MyPanel.uir", PANEL) < 0) return -1; DisplayPanel(PANEL); while (GetNextEvent() != QUIT_EVENT) ; // 在程序关闭前进行清理操作 CleanupResources(); UnregisterCallbacks(); DiscardPanel(PANEL); return 0; } ``` #### 5. 检查第三方库或插件 如果程序中使用了第三方库或插件,这些库可能在程序关闭时执行某些操作,从而引发错误。需要仔细检查第三方库的文档,确保其提供的资源释放函数在程序退出前被正确调用[^6]。 #### 6. 使用调试工具 可以使用CVI自带的调试工具或第三方调试工具(如Valgrind)来检测程序中的内存泄漏或其他潜在问题。通过这些工具,可以更精确地定位导致“fatal run-time error”的原因[^7]。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值