Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-12

TCodeTools not working correctly.

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Raymond van Venetië

Hello,

I've been trying to implent the CodeTools component in my application, but unsuccessfully.

The problem comes up when I try to "CodeTool" a unit which has Windows in the uses clause. Codetools will return with this error code: include file not found "base.inc".

We can easily reproduce this error by editing one of the codetools examples:

Open the "getcontext.lpr' project in the directory "lazarus\components\codetools\example". Now change the paths half-way the code correctly, mine are like these:
  Options.FPCPath:='C:\FPC\2.2.2\bin\i386-win32\fpc.exe';
  Options.FPCSrcDir:='C:\FPC\fpcbuild-2.2.2\fpcsrc';
  Options.LazarusSrcDir:='C:\lazarus';

If you would execute the program right now, it would run fine.

Now open "getcontextexample.pas" in the dir "lazarus\components\codetools\examples\scanexamples". And add the windows unit (might occur with different units as well, haven't found out yet). Your unit clause should look like: " Windows,Classes, SysUtils;" now.

Now restart the program ,getcontext, and you should see there occured an error.

The output for me looks like this:
C:\lazarus\components\codetools\examples>getcontext ### TCodeToolManager.HandleException: "include file not found "base.inc"" at Line=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc"

Now I've googled around a bit, and appreantly this error occured in the IDE, but got fixed. (Here is the link: http:/msg06397.html).

I'm kind of stuck at the moment, so I decided to ask if someone could help me out.

Raymond.

_________________________________________________________________ De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081207/716b898c/attachment.html

Reply by email

Mattias Gaertner
to Raymond van Venetië
Show quoted text 30 lines
Hello, I've been trying to implent the CodeTools component in my application, but unsuccessfully. The problem comes up when I try to "CodeTool" a unit which has Windows in the uses clause. Codetools will return with this error code: include file not found "base.inc". We can easily reproduce this error by editing one of the codetools examples: Open the "getcontext.lpr' project in the directory "lazarus\components\codetools\example". Now change the paths half-way the code correctly, mine are like these: Options.FPCPath:='C:\FPC\2.2.2\bin\i386-win32\fpc.exe'; Options.FPCSrcDir:='C:\FPC\fpcbuild-2.2.2\fpcsrc'; Options.LazarusSrcDir:='C:\lazarus'; If you would execute the program right now, it would run fine. Now open "getcontextexample.pas" in the dir "lazarus\components\codetools\examples\scanexamples". And add the windows unit (might occur with different units as well, haven't found out yet). Your unit clause should look like: " Windows,Classes, SysUtils;" now. Now restart the program ,getcontext, and you should see there occured an error.

It works here under linux.
(I extended the example so that you can now set the FPCTARGET environment variable to see the 'cross compile' results. I set FPCTARGET to win32, so I browsed the sources as if under windows).

Do you use the same paths in the IDE and does it work there? For example can you add the 'windows' unit to a
uses section and find the windows.pp? And then find the base.inc? (find = via find declaration)

Show quoted text 13 lines
The output for me looks like this: C:\lazarus\components\codetools\examples>getcontext ### TCodeToolManager.HandleException: "include file not found "base.inc"" at Line=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc" Now I've googled around a bit, and appreantly this error occured in the IDE, but got fixed. (Here is the link: http:/msg06397.html). I'm kind of stuck at the moment, so I decided to ask if someone could help me out.

Mattias

Reply by email

Raymond van Venetië
to Mattias Gaertner
Show quoted text 15 lines
Date: Sun, 7 Dec 2008 23:43:58 +0100 From: To: Subject: Re: [Lazarus] TCodeTools not working correctly. On Sun, 7 Dec 2008 22:08:10 +0100 Raymond van Veneti? wrote: It works here under linux. (I extended the example so that you can now set the FPCTARGET environment variable to see the 'cross compile' results. I set FPCTARGET to win32, so I browsed the sources as if under windows). Do you use the same paths in the IDE and does it work there?

Yes, the same paths.

For example can you add the 'windows' unit to a uses section and find the windows.pp? And then find the base.inc? (find = via find declaration)

Yep, in the IDE that works like a charm.

I've updated my Lazarus, and it looked like everything was working, until I removed the "{$IFDEF MSWindows}{$ENDIF}" directives from getcontextexample.pas. After that I had the same output as before (not exactly the same output, but the same error).

C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 ### TCodeToolManager.HandleException: "include file not found "base.inc"" at Lin e=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc"

So I guess that the codetoolmanager just skips the {$IFDEF MSWindows} part.. Here is the output with the compiler directives in getcontextexample.pas.

C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 Contexts found: Count=22
<Unrelated output here>

Mattias

_________________________________________________________________ Nieuw: nu ook chatten op je mobiel!
http://www.overaljevriendenbijje.nl/#superdeal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081208/068bfd20/attachment.html

Reply by email

Mattias Gaertner
to Raymond van Venetië
Show quoted text 25 lines
> Date: Sun, 7 Dec 2008 23:43:58 +0100 > From: > To: > Subject: Re: [Lazarus] TCodeTools not working correctly. > > On Sun, 7 Dec 2008 22:08:10 +0100 > Raymond van Veneti? wrote: > > > It works here under linux. > (I extended the example so that you can now set the FPCTARGET > environment variable to see the 'cross compile' results. I set > FPCTARGET to win32, so I browsed the sources as if under windows). > > Do you use the same paths in the IDE and does it work there? Yes, the same paths. > For example can you add the 'windows' unit to a > uses section and find the windows.pp? And then find the base.inc? > (find = via find declaration) Yep, in the IDE that works like a charm. I've updated my Lazarus, and it looked like everything was working, until I removed the "{$IFDEF MSWindows}{$ENDIF}" directives from getcontextexample.pas.

Ah, yes, sorry. It must be IFDEF windows.

Show quoted text 21 lines
After that I had the same output as before (not exactly the same output, but the same error). C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 ### TCodeToolManager.HandleException: "include file not found "base.inc"" at Lin e=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc" So I guess that the codetoolmanager just skips the {$IFDEF MSWindows} part.. Here is the output with the compiler directives in getcontextexample.pas. C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 Contexts found: Count=22 <Unrelated output here>

Can you try to add a line

  CodeToolBoss.SimpleInit(ConfigFilename);
  writeln('IncPath=',CodeToolBoss.GetIncludePathForDirectory('C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32'));

What is IncPath for you?

Mattias

Reply by email

Raymond van Venetië
to Mattias Gaertner
Show quoted text 7 lines
Can you try to add a line CodeToolBoss.SimpleInit(ConfigFilename); writeln('IncPath=',CodeToolBoss.GetIncludePathForDirectory('C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32')); What is IncPath for you?

With last rev, I get the following output (including that writeln):

C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 IncPath=;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\sysutils;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\classes;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\graph\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\win\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\win;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\freebsd ### TCodeToolManager.HandleException: "include file not found "base.inc"" at Lin e=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc"

When I Find the base.inc in the IDE, it turns out to be this path: C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\wininc\base.inc

But as you can see, that path isn't in the IncPath..

Raymond

Show quoted text 7 lines
Mattias _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

_________________________________________________________________ Download de nieuwste emoticons voor in je Messenger http://www.msnmessengerexperience.nl/chuck/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081208/1ceb3989/attachment.html

Reply by email

Mattias Gaertner
to Raymond van Venetië
Show quoted text 17 lines
> > Can you try to add a line > > CodeToolBoss.SimpleInit(ConfigFilename); > writeln('IncPath=',CodeToolBoss.GetIncludePathForDirectory('C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32')); > > What is IncPath for you? With last rev, I get the following output (including that writeln): C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 IncPath=;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\sysutils;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\classes;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\graph\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\win\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\win;C:\FPC\fpcbuild-2.2.2\fpcsrcrtl\freebsd

Ah. Missing in svn 17729.
Please test.

Show quoted text 9 lines
### TCodeToolManager.HandleException: "include file not found "base.inc"" at Lin e=33 Col=5 in "C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\windows.pp" Contexts not found: include file not found "base.inc" When I Find the base.inc in the IDE, it turns out to be this path: C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\wininc\base.inc But as you can see, that path isn't in the IncPath..

Mattias

Reply by email

Raymond van Venetië
to Mattias Gaertner
Ah. Missing PathDelim at end. Fixed in svn 17729. Please test.

The windows unit now indeed works! But now there's another problem, unfortunately. Now it suddenly stops finding "SysUtils".

C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 Scanning FPC sources may take a while ...
Note: TDefinePool.CreateFPCSrcTemplate UnitSearchPath emptyIncPath=;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\sysutils;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\classes;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\graph\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\ ### TCodeToolManager.HandleException: "unit not found: SysUtils" at Line=8 Col=21 in "C:\lazarus\components\codetools\examples\scanexamples\getcontextexample.pas" Contexts not found: unit not found: SysUtils

Raymond

_________________________________________________________________ Blijf altijd op de hoogte van wat jouw vrienden doen http://home.live.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081208/c196d17f/attachment.html

Reply by email

Mattias Gaertner
to Raymond van Venetië
Show quoted text 20 lines
> Ah. Missing PathDelim at end. > > Fixed in svn 17729. > Please test. The windows unit now indeed works! But now there's another problem, unfortunately. Now it suddenly stops finding "SysUtils". C:\lazarus\components\codetools\examples>getcontext TCodeToolManager.SimpleInit Config=codetools.config TCodeToolManager.SimpleInit PP=C:\FPC\2.2.2\bin\i386-win32\fpc.exe FPCDIR=C:\FPC\fpcbuild-2.2.2\fpcsrc LAZARUSDIR=C:\lazarus FPCTARGET=win32 Scanning FPC sources may take a while ... Note: TDefinePool.CreateFPCSrcTemplate UnitSearchPath emptyIncPath=;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\sysutils;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\objpas\classes;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\inc\graph\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\wininc;C:\FPC\fpcbuild-2.2.2\fpcsrc\rtl\win32\i386\ ### TCodeToolManager.HandleException: "unit not found: SysUtils" at Line=8 Col=21 in "C:\lazarus\components\codetools\examples\scanexamples\getcontextexample.pas" Contexts not found: unit not found: SysUtils

Sorry. Please try svn 17732.

Mattias

Reply by email