From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI works fine in design mode but does not work after being compiled into executable

This is an URGENT question!

I created a VI using LV 6.1 + IMAQ 6.1. It work find in the development environtment. But the I compiled the VI using Application Builder 6.1. After that the executable file would work in many ways differently than in design mode: It does not read file, gives some weird errors, does not read/write *.ini file.

I am a new Application builder user. Please, let me know if I missed something.

Thanks a lot,
0 Kudos
Message 1 of 9
(2,857 Views)
Well this kind of errors is due to the way you programmed.

Before creating an exe file, you should save your VI and sub vis in a llb. once it runs in the llb, you will have less errors in your soft.

How did you defined your file path relative/absolute?

Doc-Doc
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 2 of 9
(2,856 Views)
Doc Doc is correct. The problem is that the *exe file for a built application is constructed in the same manner as a *.llb file, with your main application VI stored inside it. This means that the path of your VI changes when you convert it from an unbuilt *.vi file to an *.exe file. The easiest method to get round this is to put your apllication in a lib in the first place. This way, the path does not change when you build it. Hope this helps.
0 Kudos
Message 3 of 9
(2,856 Views)
Thanks a lot Ged. My VI got compiled successfully. There are just problems, when using it. It does not read file correctly (my application has to read binary, text, image files from local folder).

Thanks,
0 Kudos
Message 4 of 9
(2,856 Views)
Thanks a lot Doc-Doc. My VI got compiled successfully. There are just problems, when using it. It does not read file correctly (my application has to read binary, text, image files from local folder).

Thanks
0 Kudos
Message 5 of 9
(2,856 Views)
The point is, a relative path is differnt when you've got a built app then in the development envrironment. The suggestion to develop with an llb (though I don't recomend this) is that your paths are the same as an exe. Say you use Current VI's Path function in a VI that's in a folder. It will return c:\folder\example.vi. When you build it, the returned path will be c:\folder\main.exe\example.vi. So you would have to do an extra strip path to get the actual folder name. If you develop in an llb, the returned path would have been c:\folder\main.llb\example.vi so the extra strip path would work for both development and exe. What I prefer to do is add a test to see what mode I'm in because I don't like llb's. This can be done with an applica
tion property node and the property ApplicationType.
0 Kudos
Message 6 of 9
(2,856 Views)
Hi Dennis,

Your advice is great! Thank you so much. The llb solution does not help. I tried your second solution and it works great.

Thanks again,

Son Lam.
0 Kudos
Message 7 of 9
(2,856 Views)
Actually, that's what I do too, but I couldn't think of a way to easily explain it.
0 Kudos
Message 8 of 9
(2,856 Views)
Hi,
that is really great!
This topic is a few YEARS old, I'm convinced since then some more folks tried to use .INI-Files and still the "current VI's path"-Function of LabView doesn't give a useful information of compiled VIs...
Have you ever tried to place an INI-File next to the related EXE or VI without knowing where the latter will reside?
0 Kudos
Message 9 of 9
(2,662 Views)