开发者

Error in Ada separate file

I am translating a Ada83 to Ada95 file. The problem happens when I try to compile a file which calls a separate. The error is "Illegal character " and refers to directive to preprocessor:

with BAS_PUT;

#if ADA_COMPILER="GNAT" then

WITH ADA.GNAT开发者_开发技巧_PUT;

#else

WITH ADA_PUT;

#end if;

separate(A_CALL_PUT) procedure ....

This problem does not happen when the same preprocessor directive is in a file adb that it is not a separate function.

Someone can help me???


Ada has no preprocessor, so # is indeed an illegal character.

Some compilers (eg: Gnat) do come with one, but if so it is one of their own devising. If you like you can set up your build system to run your Ada source files through external preprocessor (eg: the C pre-processor). I've never done that, but I'm told its eminently doable.

If your compiler does happen to come with a preprocessor, it is non-standard. Use it if you like, but by definition it will be useless for creating portable source files (which appears to be what you are trying to do with it).

Most folks would consider it better form to just create different source files for your different environments, and have the build environment (make rules?) switch between them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜