I have a VisualStudio C++ project with a Test.c file and it is marked as 'Compile as C++ Code (/TP)'.
The Test.c contains only the below variable,
const int test123 = 100;
After compilation, I could not find this variable in Test.obj file. I have used 'dumpbin /symbols' command to export the obj file. What could be the reason for this variable not available in obj file?
- objfile contains only below items
File Type: COFF OBJECT
COFF SYMBOL TABLE
000 010575C2 ABS    notype       Static       | @comp.id
001 80010390 ABS    notype       Static       | @feat.00
002 00000002 ABS    notype       Static       | @vol.md
003 00000000 SECT1  notype       Static       | .drectve
    Section length   41, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
006 00000000 SECT2  notype       Static       | .debug$S
    Section length   F8, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
009 00000000 SECT3  notype       Static       | .debug$T
    Section length   78, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
00C 00000000 SECT4  notype       Static       | .chks64
    Section length   20, #relocs    0, #linenums    0, checksum        0
    Relocation CRC 00000000
String Table Size = 0x0 bytes
  Summary
          20 .chks64
          F8 .debug$S
          78 .debug$T
          41 .drectve
The variable is available in obj after removing the 'const'.
 
    