Visual Studio Compile/Debug Error

Everytime I press gthe lovely green debug button I get this error:

error LNK1561: entry point must be defined

Here is my code, can you assist me on what's wrong with it. (I'm new to C++)
NOTE: If you can post a copy of the fixed code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once

namespace FormApp {

	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>
	public ref class MyForm : public System::Windows::Forms::Form
	{
	public:
		MyForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~MyForm()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->SuspendLayout();
			// 
			// MyForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(284, 261);
			this->Name = L"MyForm";
			this->Text = L"My Form App";
			this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void MyForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 }
	};
}
you do not have main() function in your program. So computer does not know, what to run first.
Can you provide the code with the main() function in. I don't know where to put it.
http://www.cplusplus.com/doc/tutorial/program_structure/
The main function is the point by where all C++ programs start their execution, independently of its location within the source code. It does not matter whether there are other functions with other names defined before or after it - the instructions contained within this function's definition will always be the first ones to be executed in any C++ program. For that same reason, it is essential that all C++ programs have a main function.
OK, So it's after the bit where I defined the namespace(s)?
Check any working program. You will see main here.
@ADAMPOKE111

The code you've posted looks wizard generated, going by the various comments.

If you created a Windows Form Application, the required main function will have been provided for you.

Not sure what's happened to the original code, but you can use the wizard to generate code for another app and steal the main from that.

And note that this code is not C++ -- it's C++/CLI (a language based on C++)

Andy
Oh, Well I've worked it out from another Wizard Generated Form App.

*marked as solved*
Topic archived. No new replies allowed.