title: yaml-cpp: Linking failed
body: <p>I'd like to use the yaml-cpp library to read some YAML strings. In order to do so, I try to compile the following C++ code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdio&gt;
  #include &lt;cstring&gt;
  #include &lt;openssl/sha.h&gt;
  #include &lt;yaml-cpp/yaml.h&gt;
  
  int main(){
      std::string yamlstr = "name: Test\ndescription: Test2";
  
      std::stringstream is(yamlstr);
      YAML::Parser parser(is);
      YAML::Node doc;
      parser.GetNextDocument(doc);
  
      return 0;
  }
  </code></pre>
  
  <p>However, it doesn't work as expected and the linker throws the following error messages when I run <code>g++ $(pkg-config --cflags --libs yaml-cpp) test.cpp -o test</code>:</p>
  
  <pre><code>/tmp/ccEPCiDN.o: In function `main':
  test.cpp:(.text+0x1e0): undefined reference to `YAML::Parser::Parser(std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'
  test.cpp:(.text+0x1ef): undefined reference to `YAML::Node::Node()'
  test.cpp:(.text+0x209): undefined reference to `YAML::Parser::GetNextDocument(YAML::Node&amp;)'
  test.cpp:(.text+0x218): undefined reference to `YAML::Node::~Node()'
  test.cpp:(.text+0x227): undefined reference to `YAML::Parser::~Parser()'
  test.cpp:(.text+0x403): undefined reference to `YAML::Node::~Node()'
  test.cpp:(.text+0x412): undefined reference to `YAML::Parser::~Parser()'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Output of <code>pkg-config --cflags --libs yaml-cpp</code>:</p>
  
  <pre><code>-I/usr/local/include  -L/usr/local/lib -lyaml-cpp 
  </code></pre>
  
  <p>Output of <code>ls -l /usr/local/lib</code>:</p>
  
  <pre><code>[...]
  -rw-r--r-- 1 root root    843138 2012-03-01 10:38 libyaml-cpp.a
  [...]
  </code></pre>
  
  <p>I currently use the version 0.3.0 but I also checked out a copy of the current repository.</p>
  
  <p>Does anyone know how to solve this problem?</p>