title: How to solve undefined symbol for architecture x86_64
body: <p>I'm trying to compile my class and I get the following result. </p>
  
  <pre><code>g++ test.cpp -lconfig++ -stdlib=libstdc++
  Undefined symbols for architecture x86_64:
    "CommandParser::parseCommand(std::string)", referenced from:
        _main in test-8f6e3f.o
    "CommandParser::CommandParser()", referenced from:
        _main in test-8f6e3f.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>This is the class that I'm trying to compile: </p>
  
  <pre><code>#include "commandparser.h"
  
  using namespace libconfig;
  
  CommandParser::CommandParser(string configFile){
    this-&gt;configFile = configFile;
  }
  
  
  CommandParser::CommandParser(){
    this-&gt;configFile = CONFIG_FILE_NAME;
  }
  
  string CommandParser::parseCommand(string cmd){
    Config cfg;
  
    try{
      cfg.readFile(this-&gt;configFile.c_str());
    }
    catch (const FileIOException &amp;fi){
      cerr &lt;&lt; "I/O error while reading file." &lt;&lt; std::endl;
      exit(1);
    }
    catch (const ParseException &amp;pe){
      cerr &lt;&lt; "Parse error at " &lt;&lt; pe.getFile() &lt;&lt; ":" &lt;&lt; pe.getLine()
                &lt;&lt; " - " &lt;&lt; pe.getError() &lt;&lt; endl;
      exit(1);
    }
  
    try{
      string path = cfg.lookup(cmd);
      cout &lt;&lt; "The path to the script is: " &lt;&lt; path &lt;&lt; endl;
      return path;
    }
    catch(const SettingNotFoundException &amp;e){
      cerr &lt;&lt; "No command with the name '"&lt;&lt;cmd&lt;&lt;"'"&lt;&lt;endl;
      exit(1);
    }
  }
  </code></pre>
  
  <p>How can I fix this and get the code to compile? 
  I'm running a Mac OSX 10.9. </p>