General

General

Why does the ANSYS Fluent UDF compiler reports undeclared identifier for a defined variable?

    • FAQFAQ
      Participant

      You get the compiler warning ‘C2065’ ‘undeclared identifier’ if you use a variable before declaring it and if you declare variables at different locations within your code. Fluent expects the code to be written in the C90 standard which is also called ANSI C. According to this standard, all variables must be declared at the beginning of a function. They may not be declared later within a block. These rules were removed in later versions of C. Although Fluent adds the ansi flag to the makefile, it depends on the compiler if this flag is evaluated correctly. Keywords: UDF; user-defined function; user defined functions; compiler; compiled; C2065; undeclared identifier