title: Undefined reference to _Unwind_Resume and __gxx_personality_v0
body: <p>I'm trying to use the JsonCpp library. I'm on Windows, using MinGW and CodeBlocks.</p>
  
  <p>When I include anything from the json headers, my linker implodes and gives out this two errors. I've started to look around and I found these two other questions which basically describe my problem:</p>
  
  <p><a href="https://stackoverflow.com/q/6045809/1356926">problem with g++ and "undefined reference to `__gxx_personality_v0'"</a></p>
  
  <p><a href="https://stackoverflow.com/q/329059/1356926">What is __gxx_personality_v0 for?</a></p>
  
  <p>And if I declare the two missing variables as void pointers, like below, the problem goes away:</p>
  
  <pre><code>void * __gxx_personality_v0=0;
  void * _Unwind_Resume =0;
  </code></pre>
  
  <p>However, I don't understand why this error happens. CodeBlocks is set up so that it uses migw32-g++ for cpp files, and also adding the -lstdc++ option does not fix the problem. Neither does the option -fno-exception ( I want exceptions, mind you, I was just trying ).</p>
  
  <p>I'm also including a boost library in the same file and that does not cause any problems.</p>
  
  <p>EDIT:</p>
  
  <p>The error output is exactly what I said in my title: I get a total of 22 undefined references to _Unwind_Resume and __gxx_personality_v0 during the linking. My code is:</p>
  
  <pre><code>#include &lt;boost/algorithm/string.hpp&gt;
  #include &lt;include/json/value.h&gt;
  //void * __gxx_personality_v0=0;
  //void * _Unwind_Resume =0;
  int main () {
      std::string str1("Hello world!");
      boost::to_upper(str1);
      Json::Value k;
      return 0;
  }
  </code></pre>
  
  <p>The error is there only when I include/use the JsonCPP library. Uncommenting the commented lines fixes the problem.</p>
  
  <p>The command line output is this:</p>
  
  <pre><code>mingw32-g++.exe -Wall -fexceptions  -g  -DSFML_DYNAMIC   -IC:\Users\Svalorzen\Documents\Projects\boost_1_49 -IC:\Users\Svalorzen\Documents\Projects\jsoncpp-src-0.5.0 -IC:\Users\Svalorzen\Documents\Projects\SFML-1.6\include -IC:\Users\Svalorzen\Documents\Projects\hge181\include  -c C:\Users\Svalorzen\Documents\Projects\test\main.cpp -o obj\Debug\main.o
  mingw32-g++.exe -LC:\Users\Svalorzen\Documents\Projects\jsoncpp-src-0.5.0 -LC:\Users\Svalorzen\Documents\Projects\SFML-1.6\lib -LC:\Users\Svalorzen\Documents\Projects\hge181\lib  -o bin\Debug\test.exe obj\Debug\main.o   -fno-exceptions -lsfml-graphics -lsfml-window -lsfml-system  C:\Users\Svalorzen\Documents\Projects\jsoncpp-src-0.5.0\libs\mingw\libjson_mingw_libmt.a C:\Users\Svalorzen\Documents\Projects\hge181\lib\gcc\libhge.a C:\Users\Svalorzen\Documents\Projects\hge181\lib\gcc\libhelp.a 
  Output size is 1.22 MB
  Process terminated with status 0 (0 minutes, 3 seconds)
  0 errors, 0 warnings
  </code></pre>
  
  <p>SECOND EDIT:
  I'm adding the command lines I use to compile the library:</p>
  
  <pre><code>g++ -o buildscons\mingw\src\lib_json\json_reader.o -c -DWIN32 -DNDEBUG -D_MT -Iinclude src\lib_json\json_reader.cpp
  g++ -o buildscons\mingw\src\lib_json\json_value.o -c -DWIN32 -DNDEBUG -D_MT -Iinclude src\lib_json\json_value.cpp
  g++ -o buildscons\mingw\src\lib_json\json_writer.o -c -DWIN32 -DNDEBUG -D_MT -Iinclude src\lib_json\json_writer.cpp
  ar rc buildscons\mingw\src\lib_json\libjson_mingw_libmt.a buildscons\mingw\src\lib_json\json_reader.o buildscons\mingw\src\lib_json\json_value.o buildscons\mingw\src\lib_json\json_writer.o
  ranlib buildscons\mingw\src\lib_json\libjson_mingw_libmt.a
  </code></pre>