title: C++ compilation error: reference to constructor is ambiguous
body: <p>I have a single source file C++ program I'm trying to compile.</p>
  
  <p>The header file looks like:</p>
  
  <pre><code>class merge {
  public:
  explicit merge(int argc, char* argv[]);
  virtual ~merge();
  };
  </code></pre>
  
  <p>And the source file looks like:</p>
  
  <pre><code>int main(int argc, char* argv[])
  {
  merge mrg(argc,argv);
  return 0;
  }
  
  merge::merge(map&lt;string,string&gt;&amp; params) {
      //code
  }
  </code></pre>
  
  <p>Trying to compile with:
  g++ merge.cpp -o merge</p>
  
  <p>I get:</p>
  
  <pre><code> merge.cpp: In function ‘int main(int, char**)’:
      merge.cpp:10: error: reference to ‘merge’ is ambiguous
      merge.h:12: error: candidates are: class merge
      /usr/lib/gcc/x86_64-redhat-            linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3180: error: template&lt;class     _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare&gt;     _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2,     _InputIterator2, _OutputIterator, _Compare)
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3122: error: template&lt;class     _InputIterator1, class _InputIterator2, class _OutputIterator&gt; _OutputIterator     std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2,     _OutputIterator)
      merge.cpp:10: error: reference to ‘merge’ is ambiguous
      merge.h:12: error: candidates are: class merge
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3180: error: template&lt;class     _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare&gt;     _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2,     _InputIterator2, _OutputIterator, _Compare)
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3122: error: template&lt;class     _InputIterator1, class _InputIterator2, class _OutputIterator&gt; _OutputIterator     std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2,     _OutputIterator)
      merge.cpp:10: error: expected `;' before ‘mrg’
      merge.cpp: At global scope:
      merge.cpp:14: error: prototype for ‘merge::merge(std::map&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::less&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;const     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;,     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;)’ does not     match any in class ‘merge’
      merge.h:12: error: candidates are: merge::merge(const merge&amp;)
      merge.h:14: error:                 merge::merge(int, char**)
      merge.cpp: In constructor ‘merge::merge(std::map&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::less&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;const     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;,     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;)’:
      merge.cpp:15: error: declaration of ‘std::map&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::less&lt;std::basic_string&lt;char,     std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;const     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;,     std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt; params’     shadows a parameter
      merge.cpp:16: error: ‘argc’ was not declared in this scope
      merge.cpp:16: error: ‘argv’ was not declared in this scope
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: At global scope:
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: In instantiation     of ‘std::iterator_traits&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;,     std::allocator&lt;char&gt; &gt; &gt;’:
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:803:   instantiated from ‘void     std::vector&lt;_Tp, _Alloc&gt;::_M_initialize_dispatch(_InputIterator, _InputIterator,     __false_type) [with _InputIterator = std::basic_string&lt;char, std::char_traits&lt;char&gt;,     std::allocator&lt;char&gt; &gt;, _Tp = int, _Alloc = std::allocator&lt;int&gt;]’
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:262:   instantiated from     ‘std::vector&lt;_Tp, _Alloc&gt;::vector(_InputIterator, _InputIterator, const _Alloc&amp;) [with     _InputIterator = std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;,     _Tp = int, _Alloc = std::allocator&lt;int&gt;]’
      merge.cpp:86:   instantiated from here
      /usr/lib/gcc/x86_64-redhat-    linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h:129: error: no     type named ‘iterator_category’ in ‘struct std::basic_string&lt;char, std::char_traits&lt;char&gt;,     std::allocator&lt;char&gt; &gt;’
  </code></pre>
  
  <p>Any idea what's wrong?</p>