Forum > TAChart

TAChart error compiling old project

<< < (2/2)

I just remembered, the same thing happened to me last month on my work PC, again with a project where I use TAChart.
In the end, I solved it by doing the same thing I did back then: I created a new project in which I copied both the dialog objects and the code.

Now compiling, I have no more errors.

Hi Mario

"Percorsi di ricerca" - is this "Search path"? If yes, then you are setting up your project incorrectly. Adding Lazarus units to the "search path" is the Delphi way. In Lazarus this can cause lots of trouble, like the one you are reporting.

Suppose you need the TDateTimePicker in your project. You simply drop a TDateTimePicker component on your form from the component palette. This adds DateTimeCtrls package to the "Required packages" of your project (look at it in the Project Inspector), but not to the search path. Lazarus knows from the package where all the DateTimePicker units are. If you'd have them in the search path your project would recompile the DateTimePicker units which makes other compiled units no longer valid, and the IDE would attempt to recompile these units as well which might fail because your project does not know where all these Lazarus units are.

If you want to create the DateTimePicker at runtime, do the same: Add its package, DateTimeCtrls, to the "Required packages" of the project: Open the Project Inspector, click "Add" > "Required Packages" > Select "DateTimeCtlrs" from the package list > "OK". DO NOT ADD ANYTHING TO THE SEARCH PATH (sorry for shouting, but this is important).

Remove DateTimeCtrls, SynEdit, LazControls, and IdeIntf from the search path, and add them to the "required packages", except for the last one. Because it is another issue that use IdeIntf. This makes things even worse because now lots of code internally used by the IDE is compiled into the project.

So, two elemental rules with Lazarus projects:
1. Do not add Lazarus units to the search path, use packages instead
2. Do not use IDEIntf in your project.

Ok, thanks for all !

Hi, Mario


[0] Message Index

[*] Previous page

Go to full version