* * *

Author Topic: Can't create object file (error code:5)  (Read 468 times)

micheus

  • Jr. Member
  • **
  • Posts: 61
Can't create object file (error code:5)
« on: September 14, 2017, 07:27:12 pm »
I was getting this error during the build operation of a new project:
Code: Pascal  [Select]
  1. Free Pascal Compiler version 3.0.0 [2016/02/14] for i386
  2. Copyright (c) 1993-2015 by Florian Klaempfl and others
  3. (1002) Target OS: Win32 for i386
  4. (3104) Compiling project1.lpr
  5. (3104) Compiling unit1.pas
  6. (9022) Compiling resource U:\Micheus\lib\i386-win32\project1.or
  7. (9015) Linking project1.exe
  8. U:\Micheus\project1.lpr(20,1) Error: (9003) Can't create object file: project1.exe (error code: 5)
  9. U:\Micheus\project1.lpr(20,1) Fatal: Can't create executable project1.exe
  10. Fatal: (1018) Compilation aborted

By looking at the forum I found this comment in a thread which was related to the same error:
Before we go to far here, I just found something that is intriguing.  I copied the project files to a different folder, renamed them, saved them from the Lazarus environment to the new folder and now the project compiles, creates the exe and runs.  Is my project name the issue??

Then I thought the error would be related to the place where I'm storing the project.
I was initially using a mapped hard driver (U:\ - pointing to a folder in another PC), but after I read that post I moved my project to my local hard driver (C:\) and it compiled without error.

As a side note, the U:\ is a shared folder in local and external hard driver, so I also used the real path (z:\users\Micheus\project1.lpr) and it compiled fine too.

So, Not be able to build in a "remote" folder is an correct/acceptable behavior?

howardpc

  • Hero Member
  • *****
  • Posts: 2393
Re: Can't create object file (error code:5)
« Reply #1 on: September 14, 2017, 07:38:20 pm »
It looks like the compiler accepts the mapped folder OK, but the linker not.
Do you use the built-in linker or an external linker?

Thaddy

  • Hero Member
  • *****
  • Posts: 4622
Re: Can't create object file (error code:5)
« Reply #2 on: September 14, 2017, 07:40:52 pm »
Note that if project1.exe is running... (anywhere) that will also generate this error because the exe is then locked. Detaching the debugger can help as well.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

micheus

  • Jr. Member
  • **
  • Posts: 61
Re: Can't create object file (error code:5)
« Reply #3 on: September 14, 2017, 07:48:15 pm »
It looks like the compiler accepts the mapped folder OK, but the linker not.
Do you use the built-in linker or an external linker?
Lazarus 1.6 + FPC 3.0.0
From the IDE Options:
Code: Pascal  [Select]
  1. Lazarus directory: Z:\Usuarios\Micheus\Instalations\lazarus\
  2. Compiler executable: Z:\Usuarios\Micheus\Instalations\lazarus\fpc\3.0.0\bin\i386-win32\fpc.exe
  3. FPC source directory: $(LazarusDir)fpc\$(FPCVer)\source
  4. Make executable: $Path($(CompPath))\make.exe

But, Lazarus is started from an shortcut this way: U:\Micheus\Instalations\lazarus\lazarus.exe
Could that be the problem?

Note that if project1.exe is running... (anywhere) that will also generate this error because the exe is then locked.
That is not the case.
Although I used a new project "project1.lpr" to generate the error to be reported here, my project is named and is a fresh one - never used that name before and even this PC.  :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus