My code was working Great! until i added a vector named "resudibus"to my namespace in a windows form.

#pragma once
#include <Windows.h>
#include <msclr\marshal.h>
#include <iostream>
#include <string.h>
#include <vector>
#include <fstream>
using namespace std;
using namespace System;
using namespace System::IO;
using namespace msclr::interop;

namespace Project1 {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary>
    /// Summary for MyForm
    /// </summary>

    std::vector<int> resudibus(1);

it gives me the following error messages :
WinCLI.obj : error LNK2005: "class std::vector<int,class std::allocator<int> > Project1::resudibus" (?resudibus@Project1@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in MyForm.obj

1>fatal error LNK1169: one or more multiply defined symbols found

But i am sure that i havent declared this file anywhere else, when i remove it everything starts to work as usual... What am i doing wrong here?

I was just joking, that is to say, I'm less than amateurish in C++. If I could have helped you, I'd have written a suggestion or something from the very beginning, without teasing you. So we should wait for other more... professional results.

This article has been dead for over six months. Start a new discussion instead.