title: Try to find global variables from compiled files. The program can't distinguish constants from global variables.
body: <p>Good Day! I'm trying to find the decision for a long time. </p>
  
  <p>My problem is:</p>
  
  <p>For example I have 2 .cpp files, one of them containing</p>
  
  <pre><code>const std::string DICTIONARY_DEFAULT = "blah";
  const std::string ADDTODICTIONARY_DEFAULT = "blah";
  const std::string BUTTONS = "blah";
  </code></pre>
  
  <p>and the second one with</p>
  
  <pre><code>static int  x1;
  static int  NewY1, NewY2, NewX1, NewX2;
  </code></pre>
  
  <p>Both fragments are in the global variables section. I need to print the global static variables (for example), but ignore constants. In nm output they're looking absolutely identical (b-type for every case, which means uninitialized local scope symbol). Is there any way to separate this cases automatically using only linux utilities (grep, regexps and so on are perfectly okay)?</p>
  
  <p>MY TASK FOR BETTER UNDERSTANDING:</p>
  
  <p>There is a program in C++, the main task is to find and to withdraw the list of global variables.
  Input data looks like archives with lots of .cpp files. Every .cpp file is syntactically correct program in C++ (It Must successfully compiled using compilier GNU C++ and Microsoft Visual C++).
  For every file from the archive I must output in separate string the name of the file and the list of global variables, like in the example:</p>
  
  <p>Output Data :</p>
  
  <pre><code>000000.cpp ancestor ansv cost graph M N p qr query u
  000001.cpp
  000002.cpp
  000003.cpp
  000004.cpp
  000005.cpp
  000006.cpp
  000007.cpp edge tree
  </code></pre>