Error: "ambiguous symbol; std::vector<_Ty>"

713 views Asked by At

While I was compiling a written C++/CLI Windows Forms application in Visual C++ 2010, I faced this error: ambiguous symbol; std::vector<_Ty>

Here is part of my code:

#include <windows.h>
#include <list>
#include <string>
#include <cctype>
#include <fstream>
#include <conio.h>
#include <vector>

#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace std;
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;

/////// global data of algorithm ////////
bool flag =false;
vector<string>sent;
int token=0;
struct lexicon
{
    string name;
    string type;//noun, verb, particle
    string subtype;//proper name, noun, pronoun
    string num;//1:singular 2:double 3:plural
    string gender;//f:female m:male
    string speaker;//1:I,we 2:you 3:they,she,he,it
    string defined;//true:defined false:undefined
    string tran;//for verbs--> 0:intransitive 1:transitive 2:ditransitive
    string res;
};
 vector<lexicon> stat;
 lexicon temp;
 std::vector<lexicon> dec;

 ////////search inside the dictionary
 void search(string word)
 {
for(vector <lexicon>::iterator i=dec.begin(); i!=dec.end();++i)
{
    if(word==(*i).name)
    {
        stat.push_back((*i));
        flag=true;
        break;
    }
}

//if the word is not found in the lexcion--> end the program
if(flag==false)
     {
     MessageBox::Show( "This word is not in lexicon \n");
     //cout<<"This word is not in lexicon"<<endl<<endl;
    //--getch(); 
    //--exit(1);
}
flag=false;
 }
 public ref class CExercise : public Form
 {
 private:
  Label ^ lblTitle;
  ComboBox ^ cbxAcademicDisciplines;

TextBox^  textBox1;
    Label^  label1;
Button^  End_Button;
Button^  Next_Button;
   public:
     CExercise()
     {
InitializeComponent();
    }

   private:
    void InitializeComponent()
    {
    textBox1 = (gcnew TextBox());
label1 = gcnew Label();
    End_Button = gcnew Button();
    Next_Button = gcnew Button();
    End_Button->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10,          System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
            static_cast<System::Byte>(0)));
        // End_Button->ForeColor = White;
        End_Button->Location = Point(142, 216);

        End_Button->Size = System::Drawing::Size(120, 30);
        End_Button->TabIndex = 2;
        End_Button->Text = "End of sentence";
        End_Button->UseVisualStyleBackColor = false;
        End_Button->Click += gcnew System::EventHandler(this,   &CExercise::End_Button_Click);
        Controls->Add(End_Button);
    }
private: System::Void Next_Button_Click(System::Object^  sender, System::EventArgs^    e) {

          int selectedIndex = comboBox1->SelectedIndex;
              Object^ selectedItem = comboBox1->SelectedItem;
          Object^ textboxdata = textBox1->Text;
          comboBox1->SelectedIndex = 0;//////////////
         // lexicon temp;
          MarshalString ( textboxdata->ToString(), temp.name);
          sent.push_back(temp.name);
          token++;
          MarshalString ( selectedItem->ToString(), temp.type);
          selectedItem = comboBox7->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.subtype);
          selectedItem = comboBox3->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.num);
          selectedItem = comboBox6->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.gender);
          selectedItem = comboBox5->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.speaker);
          selectedItem = comboBox4->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.defined);
         selectedItem = comboBox9->SelectedItem;
          MarshalString ( selectedItem->ToString(), temp.tran);
         // dec.push_back(temp);
          comboBox1->SelectedIndex = 0;
          comboBox7->SelectedIndex = 0;
          comboBox3->SelectedIndex = 0;
          comboBox6->SelectedIndex = 0;
          comboBox5->SelectedIndex = 0;
          comboBox4->SelectedIndex = 0;
          comboBox9->SelectedIndex = 0;
          textBox1->Text = " ";


      MessageBox::Show( "Selected Item Text: " + selectedItem->ToString() + "\n" +
      "Index: " + selectedIndex.ToString() );
     }
      };
   int APIENTRY WinMain(HINSTANCE hInstance,
         HINSTANCE hPrevInstance,
         LPSTR lpCmdLine,
         int nCmdShow)
 {
   Application::Run(gcnew CExercise);


    return 0;
   } 
0

There are 0 answers