Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:41:33+00:00 2026-05-27T16:41:33+00:00

i have written a sample program.below: #include<iostream> #include<string> #include<set> using namespace std; int main()

  • 0

i have written a sample program.below:

#include<iostream>
#include<string>
#include<set>
using namespace std;

int main()
{

std::set<std::string> m;
m.insert("1-2-1-1");

return 0;
}

This works perfectly without any errors.

But i try to create a set and try to insert elemts into it in my application code,it gives me the some errors.

        /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<std::InputIterator1, std::InputIterator2, std::OutputIterator>(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<std::set<std::string>> 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"

below is the code that i have added.
but after commenting the below code.the compilation is successful

/*
std::set<std::string> valid;
valid.insert(string("1-1"));

std::set<std::string> planned;
valid.insert(string("1-1"));

std::set<std::string> 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.

below is the code that i have added:

std::set<std::string> valid;
valid.insert(string("1-1"));

could any one give me the right direction?

Below is the compilation flags:

/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

but for the sample program i am simply compiling like below:

/export/SunStudio/SUNWspro/bin/CC 0001.cc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:41:33+00:00Added an answer on May 27, 2026 at 4:41 pm

    It sounds like you have two variables in the same function that are named “valid”. Rename your new variable to valid2 or change your code to just use a single variable named valid, with a single declaration.

    You can NOT just write code like valid.insert(string("1-1")); unless it is inside a function. In the comment below, you said it is not in a function. You need to find some constructor of std::set<std::string> that has the same effect as calling insert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a sample program below. class Program { static int x =
Below I have written a sample program that I have written to learn about
I have written some sample program and DLL to learn the concept of DLL
I am working on Email client application. I have written one sample program for
I have written a sample console application to test backgroundworker using one of the
I have a very simple VB.net Windows Service written using VS.net 2008. The program
I have written a small Sample program to see about Eclipse Conditional Break Points
I have written a simple C++ shell program to parse large XML files and
In sockets I have written the client server program. First I tried to send
I have written a mail-processing program, which basically slaps a template on incoming mail

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.