March 28, 2024, 05:59:44 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Cannot link exe files

Started by Andy, March 04, 2018, 12:46:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

March 04, 2018, 12:46:22 AM Last Edit: March 04, 2018, 12:54:07 AM by Andy
This is a frustrating and strange one.

For some reason, I can only compile any program once, on the next compile (even not choosing to execute as well) I'm getting a linking error.

Compiling Resources...
No Errors

Compiling...
win2.iwb

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Generating c:\10\win2.exe
Error: Unable to open output file c:\10\win2.exe
Error(s) in linking c:\10\win2.exe


Here win2 is simply the "Hello world" open window example that comes with IWB.

When building library files, I get this on second build:

Creating Library...
Error: Could not create temporary link file C:\IWBDev3\libs\link_static.bat


I've tried different folder locations, check permissions, tried turning off my Avast AV, even re-installed IWB - still the same problem.

I've scanned the whole drive for any virus - it's clean.

Even tested the hard drive with the Seagate tools - again, it's good.

Help!!!!!!!!!
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Have you checked Task Manager to see if there any parts of your program still running?

Brian

Andy

Yes I did that,

No it wasn't running.

This is a very strange one.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

After spending most of the day trying to fix the problem, I decided to wipe the partition and re-install everything.

Now everything is okay again.

What caused the problem, I don't know, at least I can compile again.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Well, that sounds drastic! But if it worked, that's OK. Strange one . . .

Brian

Andy

The linking error has returned again.

I can build / run / exit an .exe file, manually delete it and repeat the build / run - that's fine.

If I repeat build / run / exit without manually deleting the .exe I get the linking error.

When I get the linking error and right click on the .exe file the "Delete" and "Rename" options now have the administrator shield symbol showing - and it won't let me delete it.

If a wait around 45 seconds, the .exe file gets deleted (without me doing anything).

So the problem must be in the linker file.

This is nothing to do with user rights etc, it is like the linker is unable to delete the existing exe file fast enough / or the OS is taking too long?

Tried all the usual things, including ownership of the folders, IWBDev files, re-installing IWB etc.

Brian came up with a solution for him by removing some IWB registry entries, but I don't have anything like Brian's in my registry - and yes I'm sure the .exe isn't still running.

Any ideas?




Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

I've never seen or heard of that before Andy.  I'll have to do some looking to see if I can find anything.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

I have run into this a few times and you do have to find it in 'Task Manager', however, it was not running under 'Apps', it was running under 'Background Processes'.  It happened often enough I created a batch file to remove it.

Sample:
Taskkill /T /F /IM order_entry.exe
Hope that helps,
Bill
When all else fails, get a bigger hammer.

Andy

Thanks guys,

Bill, sorry that doesn't help.

I made an exe from the OPENWINDOW example in the help file - called it 1234.exe

It just does the same as all the others.

Looked into processes etc, just lists it as "Terminated", and until it disappears from the list (task man) it won't work.

Andy.
 
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

I would think that with it still in Task Man, that the system still has not closed all the stuff in the program.  Try doing the Taskkill and see if that helps.

Bill
When all else fails, get a bigger hammer.

LarryMc

Andy

In the File menu under compile options check to make sure everything looks right there.

Then click your Executable Options button and then select the Advanced button and make sure there is no garbage in the Assembler Options window.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

June 28, 2019, 06:29:41 AM #11 Last Edit: June 28, 2019, 06:31:26 AM by Andy
Thanks everyone, but no cigar.

Checked all settings.
Installed IWB 3.03 on different machine to test - same problem.
Turned of disk indexing.

Tried everything I can think of - it looks like a windows file locking problem.

I tried this with two simple programs (A and B.exe):

Program A - comp[ile / run / exit - okay
Program A - comp[ile / run / linking problem.

Program B - comp[ile / run / exit - okay
Program B - comp[ile / run / linking problem.

Then went to the folder the exe's were in.
Could not manually delete them - BUT - they both get removed at the same time after something like 30 - 40 seconds?

So it's like I'm waiting for windows explorer to update itself?

It's the only way to describe it.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Andy,

Try Windows Update, and make sure your drivers are up to date. Seems to be a problem after Windows 10 Creator update. Even if you haven't updated, it's worth a try

Brian

LarryMc

yeah, it's like you've got your computer making an automatic backup or sync or something like that ; that is slow.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

If all the suggestions fail, you can install IWB to a USB memory stick and run it from there. I did, and got rid of the annoying update trouble.


Egil
Support Amateur Radio  -  Have a ham  for dinner!

fasecero

Just a few additional comments:

- Close IWB and run the program as an Administrator.
- Set the output-directory for your executable(s) to a folder located inside My Documents. This folder should have write permission.
- Add IWB to your antivirus Whitelist.

Andy

Thanks guys,

But nothing works.

Everything else on my system runs just fine and quick, no problems what so ever.

IWB has to delete (or send a message to the system to delete) the existing .exe file and there lies the problem.

I wrote a simple console program with DELETEFILE in to delete the other .exe, it returns 1 for success - but still the .exe remains until the system bins it.

Noticed is Resmon it states the .exe is terminated but memory usage slowly counts down to zero - only then can I build another copy.

Strange.

And another thing, as I said I tried it on another machine and it does the same?

Both are Win 7 32 bit.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

And what happens when you manually delete those .exe files? Do you notice the same behavior?
If you temporarily disable your AV is this still happening?
It would also be useful to know the value DeleteFileA (the winapi version) returns.

I'm asking these questions because maybe this problem isn't related to IWB.

Brian

Andy, have you tried optimising your HD?
Brian

Andy

June 30, 2019, 04:00:38 AM #19 Last Edit: June 30, 2019, 04:07:55 AM by Andy
Thanks everyone - still no joy.

Disk is optimised and checked, same problem with Avast on or off etc.

Tried a free program "LockHunter", it tells me that it's Explorer.exe which is being run by the SYSTEM user.

So no matter what permissions I have (and I've even tried from the hidden Administrator user account) it won't delete after a linking fail - just have to wait until SYSTEM deletes it.

Just out of curiosity I tried another IWB program to delete the .exe file manually.

I tried DELETEFILE and DeleteFileA commands, before I make the linking error i.e. second compile / run, I can manually delete it at this point - no problem.

But if I used another IWB program to try to delete it (even though I can do it myself) it returns 1 for success - but the file is still there - and becomes locked by SYSTEM.

Attached are screen shots.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

Aha, your images clearly show what's going on. This is an unusual case, Andy. I'm... out of ideas. Maybe by doing some research online we may be able to find a similar case. I'll do some research.

fasecero

Okay, after checking some sites this can happen to any compiler/linker. The linking process is likely to be blocked by

1) Your AV / Firewall
2) Application Experience Service is disabled

If you're quite sure sure that it is not your AV then check point 2.

Quote from: undefinedMake sure the Application Experience service is started and not set to disabled.

It is a Windows Service,
Run services.msc -> Application Experience

References
https://stackoverflow.com/questions/3906404/link-fatal-error-lnk1104-cannot-open-file-d-myproj-exe
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/6c125c71-a98c-446d-8c36-bda898477a92/where-is-the-toggle-to-turn-on-application-experience-service?forum=windowsgeneraldevelopmentissues

Andy

June 30, 2019, 11:45:27 PM #22 Last Edit: July 01, 2019, 04:05:15 AM by Andy
Bingo!

Application experience service!

I disabled this last year along with one or two others - wasn't a problem as the programs I was writing were complex and there was plenty of time between compiling and making more changes.

I've enabled Application experience service and everything is great now.

Thanks so much - that's some research sherlock holmes (AKA fasecero!).


Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

July 01, 2019, 03:17:01 AM #23 Last Edit: July 01, 2019, 03:44:44 AM by Brian
Never heard of it!

In fact, I don't even see it in my list of Services

Brian

Andy

Brian,

If you run services.msc you will (or should) see the attached - or something like it.

Don't forget - I'm on Win 7.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.