Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8817431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:50:51+00:00 2026-06-14T04:50:51+00:00

I’m building a school project that uses ICloneable. It’s a very straight forward project,

  • 0

I’m building a school project that uses ICloneable. It’s a very straight forward project, but I can’t seem to be able to get passed this error:

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in   function ___tmainCRTStartup
1>C:\Users\Ed\Documents\Visual Studio 2012\School_Projects\Cpp   Programs\CppInterfaceProgramming\Debug\CppInterfaceProgramming.exe : fatal error LNK1120: 1   unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 

The project is set up as a CLR console application using VS2012. I’m sure that I’ve selected the correct application.

This is the code that is giving me the problem:

/*
TestCloning class provides for testing of Circle and Square classes

*/
#include "stdafx.h"
#include "Square.h"
#include "Circle.h"

using namespace System;

ref class TestCloning
{
private: static ConsoleKeyInfo^ cki;
     static Object^ Copy (ICloneable^ o)
     {
         Object^ newObject = o->Clone();
         return newObject;
     }

     static void main()
     {
         while (true)
         {
             copyOrExit();
             if (cki->ToString() == "S")
             {
                 displayAndCopySquare();
             }
             else if (cki->ToString() == "C")
             {
                 displayAndCopyCircle();
             }
             else if (cki->Key == ConsoleKey::Escape)
             {
                 Environment::Exit(0);
             }
         }// while
     } // main

     // provide prompt for user to copy object or exit
     static void copyOrExit()
     {
         Console::WriteLine(L"Press the Escape key to exit, S to display and copy a Square object, " +
             "or C to display and copy a Circle object. ");
         cki = Console::ReadKey(true);
         Console::WriteLine(L"\n");
     } // end copyOrExit method

     // method to display and copy features of a square based on user input
     static void displayAndCopySquare()
     {
         String^ userInput;
         bool isNum;
         double sideLength = 0;

         while (true)
         {
             Console::WriteLine(L"Please enter a number representing the length of one side of a squareto "+
                 "examine and copy...");
             userInput = Console::ReadLine();
             isNum = double::TryParse(userInput, sideLength);

             if (isNum)
             {
                 sideLength = double::Parse(userInput);
                 break;
             }
             else
             {
                 Console::WriteLine(L"The value you entered is not a qualified value.  Please try again...");
                 Console::WriteLine("");
             }
         }// while (true)

         // create Square object and display
         Square^ mySquare = gcnew Square(sideLength);

         Console::WriteLine("The length of one side of this square is " + mySquare->Side);
         Console::WriteLine("The perimeter of this square is " + mySquare->Perimeter);
         Console::WriteLine("The area of this square is " + mySquare->Perimeter);

         // clone square to new object and display
         ICloneable^ clonedSquare = mySquare;
         Square^ newSquare = (Square^)Copy(clonedSquare);
         Console::WriteLine(L"The length of one side of the square clone is " + newSquare->Side);
         Console::WriteLine(L"The perimeter of the square clone is " + newSquare->Perimeter);
         Console::WriteLine(L"The area of the square clone is " + newSquare->Area);
         Console::WriteLine(L"\n");

     } // end of displayAndCopySquare method

     // method to display and copy features of a circle based on user input
     static void displayAndCopyCircle()
     {
         String^ userInput;
         double radius = 0;
         bool isNum;

         while (true)
         {
             Console::WriteLine(L"Please enter an integer representing the radius of a circle to examine and copy");
             userInput = Console::ReadLine();
             isNum = double::TryParse(userInput, radius);
             if (isNum)
             {
                 radius = double::Parse(userInput);
                 break;
             }
             else
             {
                 Console::WriteLine(L"The value you entered is not a qualified value.  Please try again...");
                 Console::WriteLine(L"\n");
             }
         } // while loop

         // create circle object and display
         Circle^ myCircle = gcnew Circle(radius);
         Console::WriteLine(L"The radius of this circle is " + myCircle->Radius);
         Console::WriteLine(L"The circumference of this circle is " + myCircle->Circumference);
         Console::WriteLine(L"The area of this circle is " + myCircle->Area);

         // clone circle to new object and display
         ICloneable^ clonedCircle = myCircle;
         Circle^ newCircle = (Circle^)Copy(clonedCircle);
         Console::WriteLine(L"The radius of this circle clone is " + newCircle->Radius);
         Console::WriteLine(L"The circumference of this clircle clone is " + newCircle->Circumference);
         Console::WriteLine(L"The area of this circle clone is " + newCircle->Circumference);
         Console::WriteLine(L"\n");
     } // end displayAndCopyCircle
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:50:52+00:00Added an answer on June 14, 2026 at 4:50 am

    You will need a main() function out of the class so the linker can find it.

    int main(array<System::String ^> ^args)
    { 
        TestCloning::main();
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.