Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Delphi XE5 - Could not compile used unit 'xxxx.pas'


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 7 - Last Post: Aug 3, 2015 11:12 PM Last Post By: Bo Berglund
Nico Callewaert

Posts: 22
Registered: 5/9/02
Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2015 6:08 AM
Hi everybody,

I'm using Delphi XE5 now a few weeks already and I run daily into another annoying thing (that I never experienced with D7). When I compile my (large) project first time in the morning, it stops compiling a few times and shows the error : Could not compile used unit 'xxxx.pas'. After that the IDE opens the form or unit. I don't change anything and just hit the F9 again. Maybe it's fine after that, but maybe not and it will stop again on another unit with the same error, again opening the file and me hitting F9 again. Finally the exe builds, after an unpredictable times of stopping. Most of the time I leave the forms or units open that Delphi was complaining about and the next times it will just build fine, most of the time for the rest of the day. I'm just wondering where this is coming from. Why is XE stumbling over those files ? I don't change a single letter of it and finally it builds anyway. I was thinking because it's a project that is coming from D7, there is maybe something wrong with the DFM file, so I dragged one of the components to another position on those forms, saved them, so the DFM would be regenerated, but to no avail. It doesn't help. And it's really random, never the same files. Did anybody experience this behaviour ?

Thanks in advance,
Nico
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2015 6:25 AM   in response to: Nico Callewaert in response to: Nico Callewaert
Nico Callewaert wrote:

Hi everybody,

I'm using Delphi XE5 now a few weeks already and I run daily into
another annoying thing (that I never experienced with D7). When I
compile my (large) project first time in the morning, it stops
compiling a few times and shows the error : Could not compile used
unit 'xxxx.pas'.

Make sure you do a build, not just a compile.


--
Peter Below (TeamB)

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2015 8:53 AM   in response to: Nico Callewaert in response to: Nico Callewaert
Nico wrote:

When I compile my (large) project first time in the morning, it stops
compiling a few times and shows the error : Could not compile used
unit 'xxxx.pas'.

Is there another error message preceding this one, to explain why it could
not be compiled?

--
Remy Lebeau (TeamB)
Nico Callewaert

Posts: 22
Registered: 5/9/02
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2015 12:28 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Nico wrote:

Is there another error message preceding this one, to explain why it could
not be compiled?

--

Hi Remy and Peter,

No other message, and it's really random.
After searching the internet, I've found something interesting from you Peter :

" Check the DPR files Uses clause. When you move a project to a new Delphi version the best strategy is to just keep the dpr, pas, and res files and delete all other files with the project name (dsk, cfg etc.). Also make sure you delete all dcus in the project directory. The open the DPR file and edit the project options to make sure no pathes there refer to the old versions files. Then examine the DPR file Uses clause, since it also contains path information for units directly added to the project. Then try to build the project. -- Peter Below (TeamB)".

This seems fixing the issue together with building instead of compiling.

Thanks !
Bo Berglund

Posts: 757
Registered: 10/23/02
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2015 4:06 PM   in response to: Nico Callewaert in response to: Nico Callewaert
A similar problem:

Whenever I have changed something in a Delphi unit in my mixed
C++/Delphi project and try to build in XE5 I get a strange error (an L
code of some type, don't relember which now) and a completely
unrelated unit opens in the editor with the caret at the last line.

If I now hit build again the process completes successfully without me
changing anything at all!

I have never understood why this happens every single time I have
edited a Delphi file but not if I edit a C++ file.

---
Bo Berglund
Sweden & Texas
Newsreader: Forte Free Agent 1.92/32.572

Bo Berglund

Posts: 757
Registered: 10/23/02
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2015 10:13 PM   in response to: Nico Callewaert in response to: Nico Callewaert
A similar problem:

Whenever I have changed something in a Delphi unit in my mixed
C++/Delphi project and try to build in XE5 I get a strange error (an L
code of some type, don't relember which now) and a completely
unrelated unit opens in the editor with the caret at the last line.

If I now hit build again the process completes successfully without me
changing anything at all!

I have never understood why this happens every single time I have
edited a Delphi file but not if I edit a C++ file.

---
Bo Berglund
Sweden & Texas
Newsreader: Forte Free Agent 1.92/32.572

Nico Callewaert

Posts: 22
Registered: 5/9/02
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2015 12:23 PM   in response to: Bo Berglund in response to: Bo Berglund
Bo Berglund wrote:
a completely
unrelated unit opens in the editor with the caret at the last line.

If I now hit build again the process completes successfully without me
changing anything at all!

Exactly what is happening, random files, caret at the last line, not changing anything at all and finally it builds :-)
Bo Berglund

Posts: 757
Registered: 10/23/02
Re: Delphi XE5 - Could not compile used unit 'xxxx.pas'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2015 11:12 PM   in response to: Nico Callewaert in response to: Nico Callewaert
On Mon, 3 Aug 2015 12:23:56 -0700, Nico Callewaert <> wrote:

Bo Berglund wrote:
a completely
unrelated unit opens in the editor with the caret at the last line.

If I now hit build again the process completes successfully without me
changing anything at all!

Exactly what is happening, random files, caret at the last line,
not changing anything at all and finally it builds :-)

Well, I had given up understanding this so I just accepted the
behaviour and moved on...
Anyway, from memory :
- The project is a CPPB project migrate from BDS2006
- I had problems migrating so followed Remy's advice to create a new
project in XE5 and then add the sources for the old project thus
discarding the old BDS2006 project file.
- It contains C++ main code but there are some Delphi units also in
the project like a couple of forms and data modules etc
- And the components in RAD Studio XE5 are mostely Delphi ones
- Whenever I have edited any of the Delphi files the following build
will stop immediately with an error (L50 if I remember correctly)
- At this time the cursor is positioned at the ending period of a
Delphi sourcefile in one of the used components. Needless to say that
file has not changed, in fact it is a support file from Safenet
defining function calls into the dongle driver. I have never ever
changed that file since 10 years or more.
- If I now hit the build button again the process completes normally.

What bugs me is that whenever I have edited a Delphi file this happens
otherwise not. And it never ever positions the cursor on anyting but
the end line of a Delphi unit which was not open in the IDE to begin
with (most often the support file from Safenet).

---
Bo Berglund
Sweden & Texas
Newsreader: Forte Free Agent 1.92/32.572

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02