找回密码
 注册
LabVIEW+单片机学习套件全套教程资料下载[免费]LabVIEW论坛精华列表贴USB0816数据采集卡《LabVIEW宝典》
LabWindows/CVI论坛精华贴NET0816以太网数据采集卡RC0210远程设备授权系统 关闭关停锁定打开设备 户外分布式数据采集
NET1624低速高精度以太网数据采集卡WIFI0824SD无线WIFI网络数据采集卡脱机运行 SD存储 小尺寸微型 串口采集远程采集 安卓 手持移动采集 纪录仪
查看: 2943|回复: 6

摘自NI的一篇极好的文章!(打包后程序找不到辅助文件的解决方法)

[复制链接]
发表于 2004-11-18 00:00:52 | 显示全部楼层 |阅读模式
<>Why Can't My Executable Load My Included File When I Use Relative Path Encoding?</P>rimary Software: LabVIEW Development Systems
Primary Software Version: 6.1
Primary Software Fixed Version: N/A
Secondary Software:


Problem: I have created an application in LabVIEW that either creates or reads from an external file. I am using relative path encoding by using the Current VI's Path function in the Functions Palette &raquo; File I/O subpalette. My program runs in the development environment and is able to successfully perform file I/O. However, when I build my application into an executable using Application Builder, I receive an error indicating that either the file cannot be found, or the path is invalid.

Solution: Notice that when you use the Current VI's Path function in the development environment, it will return to you the path in which the VI is located as well as the name of the VI. Often, the Strip Path function is then used to remove this portion of the path, and then the path is used elsewhere in the program. When the program is now built into an executable, the name of the executable now becomes part of the path, in addition to the VI's name. For example, if a VI named "Application.vi" is saved in C:\Program Files\Application, the Current VI's Path function would return C:\Program Files\Application\Application.vi when run in the development environment. Now, if the VI is built into an executable with a name of "App.exe" and saved in the same directory location, the Current VI's Path function will return C:\Program Files\Application\App.exe\Application.vi. In this case, you will need to use the Strip Path function twice to strip both "Application.vi" and "App.exe" from the path to retrieve the directory in which the executable is located.
发表于 2004-11-18 00:06:14 | 显示全部楼层
这是在做一些数据库和一些自己另外加的非VI文件时常遇到的一个问题,在没有打包前的路径和打包后的路径不相同,所以要打包前要多加一个strip path才可以的,否则它找不到!这篇文章解释的就是这个问题![em05]
回复 顶

使用道具 举报

发表于 2007-3-26 15:14:54 | 显示全部楼层

回复 #1 rights 的帖子

嘿, 不错的文章哈~~
不过这个是不是ni的一个bug呢?
回复 顶

使用道具 举报

发表于 2007-3-26 15:55:11 | 显示全部楼层
lv专门提供有属性节点进行判断是何种类型的状态,比如:编辑模式\可执行程序模式\错误模式\嵌入式运行系统模式,分开执行的.因此有这种原因.
可以采用 VI属性进行分离和判断.
回复 顶

使用道具 举报

发表于 2007-3-26 18:16:25 | 显示全部楼层
回复 顶

使用道具 举报

发表于 2007-3-26 18:43:40 | 显示全部楼层
王兄做的那个东东很好用!以后做程序的时候直接调用,非常方便!就不会有这种问题出现了,让程序在编辑和EXE状态都一样不用修改程序!
回复 顶

使用道具 举报

发表于 2007-3-26 18:50:43 | 显示全部楼层
回复 顶

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|cpubbs论坛. ( 粤ICP备09171248号 )

GMT+8, 2026-9-30 02:15 , Processed in 0.031600 second(s), 6 queries , Gzip On, File On.

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表