C1138: Illegal segment type

[ERROR]

Description

A segment name with an illegal type was specified. Functions can only be placed into segments of type CODE_SEG, variable/constants can only be placed into segments of type DATA_SEG or CONST_SEG.

Example
  #pragma DATA_SEG AA

  
  #pragma CODE_SEG BB

  
  int i @ "AA"; // OK

  
  int i @ "BB"; // Error C1138, data cannot be placed in 
  codeseg

  
Tips

Use different segment names for data and code. To place constants into rom, use segments of type CONST_SEG.

See also