title: Not able to insert elements into a set in c++
body: <p>i have written a sample program.below:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  #include&lt;set&gt;
  using namespace std;
  
  int main()
  {
  
  std::set&lt;std::string&gt; m;
  m.insert("1-2-1-1");
  
  return 0;
  }
  </code></pre>
  
  <p>This works perfectly without any errors.</p>
  
  <p>But i try to create a set and try to insert elemts into it in my application code,it gives me the some  errors.</p>
  
  <pre><code>        /export/SunStudio/SUNWspro/bin/CC -c -compat=5 -features=no%altspell -features=no%export -mt +d  -DTHREAD -DSOLARIS -staticlib=rwtools7 -library=rwtools7,iostream -DOWTOOLKIT_WARNING_DISABLED -Bsymbolic -PIC  -g0 -DBPDEBUG  -I.  -I../nls  -I../../cnacore/api  -I../../cnacore/external  -I../../cnacore/stl  -I../../cnabp/kernel  -I/vobs/oss_design/sab/inc  -I/vobs/oss_design/tbs/inc  -I/vobs/oss_design/tss/inc  -I/vobs/oss_design/tds/inc  -I/vobs/oss_design/eam/inc  -I/vobs/ossrc_3pp/cif_3pp/borland_enterprise_server/include  -I/vobs/ossrc_3pp/cif_3pp/borland_enterprise_server/include/stubs  -I/vobs/ossrc_build_dependencies/extracted_packages/ERICsnlm/include  -I/vobs/ossrc_3pp/cif_3pp/sybase_ase/OCS-15_0/include  -I/vobs/cna/src/features  cacup_bsc.cc
  "cacup_bsc.cc", line 6545: Error: Multiple declaration for valid.
  "cacup_bsc.cc", line 6545: Error: "," expected instead of ".".
  "cacup_bsc.cc", line 6548: Error: Multiple declaration for valid.
  "cacup_bsc.cc", line 6548: Error: "," expected instead of ".".
  "cacup_bsc.cc", line 6552: Error: std::set_intersection&lt;std::InputIterator1, std::InputIterator2, std::OutputIterator&gt;(std::InputIterator1, std::InputIterator1, std::InputIterator2, std::InputIterator2, std::OutputIterator) is not a static data member.
  "cacup_bsc.cc", line 6552: Error: Cannot use std::insert_iterator&lt;std::set&lt;std::string&gt;&gt; to initialize int.
  "cacup_bsc.cc", line 8903: Warning: A non-POD object of type "bpDU" passed as a variable argument to function "std::sprintf(char*, const char*, ...)".
  "cacup_bsc.cc", line 8906: Warning: A non-POD object of type "bpDU" passed as a variable argument to function "std::sprintf(char*, const char*, ...)".
  6 Error(s) and 2 Warning(s) detected.
  *** Error code 6
  clearmake: Error: Build script failed for "cacup_bsc.o"
  </code></pre>
  
  <p>below is the code that i have added.
  but after commenting the below code.the compilation is successful</p>
  
  <pre><code>/*
  std::set&lt;std::string&gt; valid;
  valid.insert(string("1-1"));
  
  std::set&lt;std::string&gt; planned;
  valid.insert(string("1-1"));
  
  std::set&lt;std::string&gt; result;
  
  std::set_intersection(valid.begin(), valid.end(), planned.begin(), planned.end(), std::inserter(result, result.end()));
  */
  
          /export/SunStudio/SUNWspro/bin/CC -c -compat=5 -features=no%altspell -features=no%export -mt +d  -DTHREAD -DSOLARIS -staticlib=rwtools7 -library=rwtools7,iostream -DOWTOOLKIT_WARNING_DISABLED -Bsymbolic -PIC  -g0 -DBPDEBUG  -I.  -I../nls  -I../../cnacore/api  -I../../cnacore/external  -I../../cnacore/stl  -I../../cnabp/kernel  -I/vobs/oss_design/sab/inc  -I/vobs/oss_design/tbs/inc  -I/vobs/oss_design/tss/inc  -I/vobs/oss_design/tds/inc  -I/vobs/oss_design/eam/inc  -I/vobs/ossrc_3pp/cif_3pp/borland_enterprise_server/include  -I/vobs/ossrc_3pp/cif_3pp/borland_enterprise_server/include/stubs  -I/vobs/ossrc_build_dependencies/extracted_packages/ERICsnlm/include  -I/vobs/ossrc_3pp/cif_3pp/sybase_ase/OCS-15_0/include  -I/vobs/cna/src/features  cacup_bsc.cc
  "cacup_bsc.cc", line 8902: Warning: A non-POD object of type "bpDU" passed as a variable argument to function "std::sprintf(char*, const char*, ...)".
  "cacup_bsc.cc", line 8905: Warning: A non-POD object of type "bpDU" passed as a variable argument to function "std::sprintf(char*, const char*, ...)".
  2 Warning(s) detected.
  </code></pre>
  
  <p>below is the code that i have added:</p>
  
  <pre><code>std::set&lt;std::string&gt; valid;
  valid.insert(string("1-1"));
  </code></pre>
  
  <p>could any one give me the right direction?</p>
  
  <p>Below is the compilation flags:</p>
  
  <pre><code>/export/SunStudio/SUNWspro/bin/CC -c -compat=5 -features=no%altspell -features=no%export -mt +d  -DTHREAD -DSOLARIS -staticlib=rwtools7 -library=rwtools7,iostream -DOWTOOLKIT_WARNING_DISABLED -Bsymbolic -PIC  -g0 -DBPDEBUG
  </code></pre>
  
  <p>but for the sample program i am simply compiling like below:</p>
  
  <pre><code>/export/SunStudio/SUNWspro/bin/CC 0001.cc
  </code></pre>