[Winforms] Erreur de compilation LNK1561
Bonjour,
J'évolue sous visual studio community 2015 en c++.
Je souhaiterais créer une application Windows Form c++.
J'effectue un test très simple :
1) Fichier --> Nouveau --> Projet --> Visual c++ --> c++ Windows form
2) J'exécute le mode Débogueur en mode local en debug.
Tous fonctionnent parfaitement bien. La fenêtre Windows Form s'affiche.
Mais en mode realise Générer la solution l'erreur suivante s'affiche :
LNK1561 le point d'entrée doit être défini.
Pourtant si j'ai bien compris les tutos c'est la procédure main le point d'entrée dans le fichier cpp.
Fichier MyForm.cpp :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
void Main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
AWinForm2::MyForm form;
Application::Run(%form);
} |
Fichier MyForm.h :
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 CppWinForm1 {
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"MyForm";
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) {
}
};
} |
Ces 2 fichiers ont été crées automatiquement lors de la création du projet.
Via Google je ne trouve pas la solution.
Si quelqu'un a des tutos sur Windows Form et explication sur le point d'entrée cela me rendrais bien service (en Français si possible).
En attente d'une réponse, cordialement.
RE SUBSYSTEM:WINDOWS et main
Bonjour,
En ce qui concerne le point d'entrée j'ai mis main et /SUBSYSTEM:WINDOWS comme vous me l'avez recommandé et cela a effectivement résolu mon problème d'affichage.
Un grand merci à vous deux d'avoir trouvé la solution et pris sur votre temps.
Cordialement.