none
C++ Link error

    Question

  • Hi  im new in c++ but im very interested. i have visual studio 2008 and 2012... i have been a VB programer for a few years now, so now i want to try my hand in something new...  

    OK now c++... i learned how to make a console APP in some study documents that i hav but i can't find C++ Windows Forms application study texts or tutorials anywhere,,,i wonder why, so now i am self studying... 

    i can create and debug a c++ windows form in VS 2008 successfully.

    BUT.in  VS 2012 i CAN'T.... i go->

    new Progect->Visual C++ ->CLR->Empty project(chosen from:Class Library,console app, empty project)

    i say ADD Item->UI->Windows form....

    COOL! now its added... but when i test run it, it gives me a LINK error 

    "Error 1 error LNK1561: entry point must be defined"

     i searched online, and they say i must go to : Project properties->Configuration Properties->Linker->system:

    and then set the Subsystem option to  "Windows(/SUBSYSTEM:WINDOWS)"

    but that still doesnt help... please i need profesaional help.

    can anyone please help me

    Friday, July 22, 2016 11:05 PM

Answers

All replies

  • If you have c/C++ questions, you will probably have better luck in one of the C++ forums.

    This particular error means you did not define a function named main.  Every C++ program receives control in that function.

    Saturday, July 23, 2016 8:32 AM
  • i tried to find c++ forum here but cant find so im trying... i know the main() function is needed... but i cant put it in. where to put it in,,,,in C++ 2008 and 2012 when u make  windows forms application and u view the automatic code required,,,then the main() isnt there... even in the 2008 that run successfully off the block.... 2012 just doesnt want to.... with or without a main.... 

    see here is the code that run successfully in 2008 and its witout a main() and it was generated automatically... i havn't touched it....just created a project and ran it...and it works... but 2012 loks EXACTLY the same...but give the link error

    #pragma once


    namespace TEST {

    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 Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
    Form1(void)
    {
    InitializeComponent();
    //
    //TODO: Add the constructor code here
    //
    }

    protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~Form1()
    {
    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();
    // 
    // Form1
    // 
    this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->ClientSize = System::Drawing::Size(284, 262);
    this->Name = L"Form1";
    this->Text = L"Form1";
    this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
    this->ResumeLayout(false);

    }
    #pragma endregion
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {

    }
    };
    }


    • Edited by RickSmit123 Sunday, July 24, 2016 9:53 AM not done
    Sunday, July 24, 2016 9:48 AM
  • There are at least two active C++ forums: C++ Standards, Extensions, and Interop and Visual C++.
    Sunday, July 24, 2016 5:05 PM