25 July 2012

A user has reported that CodeSnip fails to compile snippets with Delphi XE2 and issues an error that suggests it can't find the required .dcu files.

EDIT:What follows was not the problem at all! It was in fact the VCL etc. units that couldn't be found and is to do with XE2 namespaces. The problem, and a work around, has been written up in this FAQ. (Actually this should a a TAQ - twice asked question!)

This may be because XE2 uses different folders for .dcu files depending on whether it is compiling for 32 bit or 64 bit.

Because I don't have XE2 I'm looking for someone who does to check if snippets compile OK on their system (requires CodeSnip v3.9.0 or later).

Additionally, I'd like you to also check if setting the -$N command line switch enables compilation to work, whether or not you find snippets compile OK.

To do this from CodeSnip, use the Tools | Configure Compilers menu option to display the Configure Compilers dialogue box. Select Delphi XE2 in the left hand list then select the Command Line tab. In the Add or edit switch edit box enter -N0.\ (that's dash N zero dot backslash) and press the Add button, then OK to accept changes.

You can revert the above change by selecting the -$N0 switch in the Switches list and pressing the Delete button.

Most grateful to anyone who can help with this. Please use comments or contact me via my website with any answers.