Start a conversation

When trying to run the Ada-C/C++ Changer on some Ada code that uses #IF/#END IF the # is flagged as an illegal character. Is there a way to get the Changer to recognize the preprocessor directives?

Preprocessor directives are not a standard part of the Ada language. Some Ada vendors support them, but they don't all support them the same way. In some cases you can use the standard C preprocessor with the Ada sources, using the "-E" flag to gcc, for example, to have it process only the preprocessor directives and produce an expanded version of the source. You will have to temporarily rename your Ada source to end in ".c" if you want "gcc -E" to expand the C preprocessor directives, then you can redirect the output, delete any remaining lines starting with "#", and rename it back to end in ".ad?". Alternatively, you might be able to use the original Ada compiler you used to develop the Ada code, and give it a flag requesting an expansion of any preprocessor directives. 

Choose files or drag and drop files
Was this article helpful?
  1. MapuSoft

  2. Posted
  3. Updated