Hi There, I am in the process of creating a game based around the board game Diplomacy.
anyway, I keep getting the following errors, and I have no idea of how to solve it.

AlliedConflict error LNK2022: metadata operation failed (80131187) : Inconsistent method declarations in duplicated types (types: frmGameScreen; methods: Country1_Clicked): (0x06000013).


The code where this (and similar) error is occuring is in the following.

#include "StdAfx.h"
#include "country.cpp"
#include "player.cpp"
#using <mscorlib.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
usingnamespace System;
usingnamespace System::ComponentModel;
usingnamespace System::Windows::Forms;
usingnamespace System::Drawing;
__gcpublicclass frmGameScreen : public Form {
 
protected:
 
 
 
Label* lblCountry1;
Label* lblCountry2;
Label* lblCountry3;
Label* lblCountry4;
Label* lblCountry5;
Label* lblCountry6;
Label* lblCountry7;
Label* lblCountry8;
country* Country1;
country* Country2;
country* Country3;
country* Country4;
country* Country5;
country* Country6;
country* Country7;
country* Country8;

private:
MainMenu* menuBar;
MenuItem* fileMenu;
MenuItem* item1;
MenuItem* helpMenu;

public: 
frmGameScreen() {

//form title caption text
Text = S"Play Game";
 
//set border style to fixed, and maximise form
FormBorderStyle = FormBorderStyle::Fixed3D;
WindowState = FormWindowState::Maximized;
BackColor = Color::White;
 
//Add various controls to form (buttons etc...)
Setup_Menu();
Setup_Labels();

//Add Form Events
Form_Load();
this->Show();
}
 
protected:
void Setup_Menu(){

//create main menu bar
menuBar = new MainMenu();

//Create File menu
fileMenu = new MenuItem("&File");
menuBar->MenuItems->Add(fileMenu);

//create and add menu items
item1 = new MenuItem("E&xit");
fileMenu->MenuItems->Add(item1);

//create Help menu
helpMenu = new MenuItem("&Help");
menuBar->MenuItems->Add(helpMenu);

//Add On Click event handlers
item1->Click += new EventHandler(this, &frmGameScreen::MenuItem_Clicked);

//Add menu to form
Menu = menuBar;
 
 
}
 
protected:
void MenuItem_Clicked(Object* pSender, EventArgs* pArgs)
{
if (pSender == item1)
Application::Exit();
}
 
 
protected:
void Setup_Labels()
{
lblCountry1 = new Label();
lblCountry1->Text = S"Country one";
lblCountry1->Size = System::Drawing::Size(150,25);
lblCountry1->Location = Point(20,225);
lblCountry1->BackColor = Color::RosyBrown;
lblCountry1->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry2 = new Label();
lblCountry2->Text = S"Country two";
lblCountry2->Size = System::Drawing::Size(150,25);
lblCountry2->Location = Point(20,270);
lblCountry2->BackColor = Color::RosyBrown;
lblCountry2->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry3 = new Label();
lblCountry3->Text = S"Country three";
lblCountry3->Size = System::Drawing::Size(150,25);
lblCountry3->Location = Point(20,315);
lblCountry3->BackColor = Color::RosyBrown;
lblCountry3->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry4 = new Label();
lblCountry4->Text = S"Country four";
lblCountry4->Size = System::Drawing::Size(150,25);
lblCountry4->Location = Point(190,225);
lblCountry4->BackColor = Color::RosyBrown;
lblCountry4->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry5 = new Label();
lblCountry5->Text = S"Country five";
lblCountry5->Size = System::Drawing::Size(150,25);
lblCountry5->Location = Point(190,270);
lblCountry5->BackColor = Color::RosyBrown;
lblCountry5->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry6 = new Label();
lblCountry6->Text = S"Country six";
lblCountry6->Size = System::Drawing::Size(150,25);
lblCountry6->Location = Point(190,315);
lblCountry6->BackColor = Color::RosyBrown;
lblCountry6->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry7 = new Label();
lblCountry7->Text = S"Country seven";
lblCountry7->Size = System::Drawing::Size(150,25);
lblCountry7->Location = Point(360,225);
lblCountry7->BackColor = Color::RosyBrown;
lblCountry7->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);
 
lblCountry8 = new Label();
lblCountry8->Text = S"Country eight";
lblCountry8->Size = System::Drawing::Size(150,25);
lblCountry8->Location = Point(360,270);
lblCountry8->BackColor = Color::RosyBrown;
lblCountry8->Font = new System::Drawing::Font(S"Times New Roman", 12, FontStyle::Regular, GraphicsUnit::Point, (Byte)0);

//Add On Click event handlers
lblCountry1->Click += new EventHandler(this, &frmGameScreen::Country1_Clicked);
lblCountry2->Click += new EventHandler(this, &frmGameScreen::Country2_Clicked);
lblCountry3->Click += new EventHandler(this, &frmGameScreen::Country3_Clicked);
lblCountry4->Click += new EventHandler(this, &frmGameScreen::Country4_Clicked);
lblCountry5->Click += new EventHandler(this, &frmGameScreen::Country5_Clicked);
lblCountry6->Click += new EventHandler(this, &frmGameScreen::Country6_Clicked);
lblCountry7->Click += new EventHandler(this, &frmGameScreen::Country7_Clicked);
lblCountry8->Click += new EventHandler(this, &frmGameScreen::Country8_Clicked);
 
//Add Labels
Controls->Add(lblCountry1);
Controls->Add(lblCountry2);
Controls->Add(lblCountry3);
Controls->Add(lblCountry4);
Controls->Add(lblCountry5);
Controls->Add(lblCountry6);
Controls->Add(lblCountry7);
Controls->Add(lblCountry8);
 
 
}
 
private:
void Form_Load(){
 
country* Country1 = new country();
Country1->CreateCountry("France","free","white",'n');
country* Country2 = new country();
Country2->CreateCountry("Italy","free","white",'n');
country* Country3 = new country();
Country3->CreateCountry("Germany","free","white",'n');
country* Country4 = new country();
Country4->CreateCountry("Britan","free","white",'n');
country* Country5 = new country();
Country5->CreateCountry("Russia","free","white",'n');
country* Country6 = new country();
Country6->CreateCountry("Africa","free","white",'n');
country* Country7 = new country();
Country7->CreateCountry("Swedan","free","white",'n');
country* Country8 = new country();
Country8->CreateCountry("China","free","white",'n');
 
 
 
 
}
 
public:
 
void Country1_Clicked(Object* pSender, EventArgs* pArgs)
 
{
 
Char clicked = Country1->GetClick();
if (clicked == 'n') {
//Only Show availble countries to click onto!
 
lblCountry2->Visible= true;
lblCountry4->Visible = true;
lblCountry5->Visible = true;
lblCountry3->Visible = false;
lblCountry6->Visible = false;
lblCountry7->Visible = false
lblCountry8->Visible = false;
Country1->SetClick('y');
}
 
else
 
{
 
lblCountry2->Visible= true;
lblCountry4->Visible = true;
lblCountry5->Visible = true;
lblCountry3->Visible = true;
lblCountry6->Visible = true;
lblCountry7->Visible = true;
lblCountry8->Visible = true;
Country1->SetClick('n');
}
 
 
 
}
 
//etc for Countries 2 through 8 
 
};

Any advise or help you could give would be greatly appreciated :)

Documentation is a good thing.

Thanks, I agree, documentation is a good thing, if it helps. :( I have looked at this documentation already, and found that I couldn't understand it, and it was not relevant to what I was wanting. (thus this post). The error is a LNK2022 error with a further code of 80131187, and I can not find any info on the further code.

I was hopeing that someone may have come across this error before and know how to solve it, or to be able to look through my code and possibly see what I have done wrong :)

Thank you.

>and found that I couldn't understand it, and it was not relevant to what I was wanting.
If you couldn't understand it, how do you know it's not relevant to your problem? It sounds to me like you aren't willing to go through the steps of research to find your solution, so you posted here hoping to get spoonfed. All I have to say about that is go do your own research. Here's another resource just because I'm a nice person:

http://groups-beta.google.com/groups?q=LNK2022

Seeing as no one here could help me, I started the project again. I struck the problem again, but noticed when it happend.

Incase anyone else ever gets this problem I thought I would share what I have learnt. It has something to do with changing the name of an object or something. Anyway, to try to solve it, delete the whole debug folder for application and then Re-Build the project. This should slove the problem :)

"Anyway, to try to solve it, delete the whole debug folder for application and then Re-Build the project. This should slove the problem :)"

Thanx for posting that. I was having trouble with this error too, and that solved it.:cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.