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 8245241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:07:10+00:00 2026-06-07T22:07:10+00:00

EDIT: What is C++/CLI? I am programming in Visual studio, and as far as

  • 0

EDIT: What is C++/CLI? I am programming in Visual studio, and as far as I know using C++… Also, The first error was solved by Peter’s comment, but I am still stuck on the second.

I am brand new to the world of C++, and have previously done all my work in Java. I am unfamiliar with the use of pointers and garbage collection (though I believe I understand the concept) and I believe that may be the source of my problems. I am getting the following error messages:

1>Runner.cpp(6): error C3145: 'formOutOfTime' : global or static variable may not have managed type 'System::Windows::Forms::Form ^'
1>          may not declare a global or static variable, or a member of a native type that refers to objects in the gc heap
1>Runner.cpp(22): error C2061: syntax error : identifier 'FormOutOfTime'

My code is like this:

PurpleHealth.cpp (This is the file I believe the system calls to start it all off):

#include "FormOutOfTime.h"

#include "FormParentalOverride.h"
#include "Runner.h"

using namespace PurpleHealth;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
    // Enabling Windows XP visual effects before any controls are created
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false); 

    // Create the main window and run it
    //Application::Run(gcnew FormOutOfTime());
    Runner* runner = new Runner();

    //delete runner;

    return 0;
}

Runner.h (this is the header file I want to run all my main code, and launch the forms. I also struggle with the purpose behind the header files)

#include "stdafx.h"
#include "FormOutOfTime.h"
#include "FormParentalOverride.h"

class Runner
{
public:

    Runner();
    ~Runner();

    // functions

private:

    void Go();
    // member variables

};

And Finally Runner.cpp:

#include "stdafx.h"
#include "Runner.h"
#include "FormOutOfTime.h"
#include "FormParentalOverride.h"
//Variable Dclaration
System::Windows::Forms::Form^ formOutOfTime;//Error Here***************************

Runner::Runner()
{
    // Do stuff if you need to

    this->Go();
}

Runner::~Runner()
{
    // Clear memory if you need to
}

void Runner::Go()
{
     formOutOfTime = gcnew FormOutOfTime();//Error Here***************************
    formOutOfTime->ShowDialog();
}

Please help me solve these messages, and even critique on form is appreciated. Thanks.

  • 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-07T22:07:12+00:00Added an answer on June 7, 2026 at 10:07 pm

    managed pointers cannot be declared at static or global scope. They can only be declared at function scope. Move the declaration of formOutOfTime from the top of the runner.cpp file to within the Go method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a simple GDI-based data plotter using C++/CLI but it's not particularly fast
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: iam using ajax to load text in my content that is why onload
This is a C++/CLI WinForms project targeting the .NET 2.0 framework. I am using
I've got a peculiar error writing some C++/CLI code. I'm trying to make a
While using PHP cli in ubuntu i got apache as web server i cant
I know that PHP CLI is usually used because of none time limits and
I am using an ORM which generates large amounts of files from a CLI.
EDIT: Sorry, forgot to mention this was a C++/CLI project. Does it show it
I'm writing my first typed/racket application which is a cli application which asks you

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.