Attila Kovacs 666 Posted Saturday at 01:00 PM given this program Project1; {$APPTYPE CONSOLE} {$R *.res} uses Generics.Collections, System.Generics.Collections; begin end. the ide will not complain, possibly msbuild but with "dcc32 -NSSystem Project1.dpr" it's an "Identifier redeclared". Where’s the logic in that? Share this post Link to post
Uwe Raabe 2159 Posted Saturday at 01:22 PM The IDE implicitly adds an alias for Generics.Collections=System.Generics.Collections which suppresses that error. Although not specified in the project itself, this alias is added in CodeGear.Common.targets. Share this post Link to post
Attila Kovacs 666 Posted Saturday at 01:35 PM 12 minutes ago, Uwe Raabe said: The IDE implicitly adds an alias for Generics.Collections=System.Generics.Collections which suppresses that error. Supresses the error? Why? Share this post Link to post
Uwe Raabe 2159 Posted Saturday at 02:04 PM If a unit is resolved by the -A option, any double occurrence is silently resolved, too. So, strictly speaking, the error is not suppressed in the sense of it is an error, but we don't show it, but rather internally resolved by removing the superfluous occurrences. In my blog article Conditional Uses Clause Considered Harmful one of the suggestions (Solutions 2) actually makes use of this behavior. Share this post Link to post
Attila Kovacs 666 Posted Saturday at 02:14 PM I just don't understand why msbuild would ignore the duplicates, but dcc does not. I added 'System' with -NS to dcc32, just like in the Project settings in the IDE where unit scope names are also set. I would expect the same behavior. Share this post Link to post
Uwe Raabe 2159 Posted Saturday at 02:27 PM The IDE as well as MSBuild are using the dproj file of your project, while the compiler only sees the dpr. At the end of the dproj file there is an import command for CodeGear.Delphi.Targets, which itself imports CodeGear.Common.Targets. The latter sets the UnitAliases given to the compiler. 1 Share this post Link to post