Okay, so I understand this C# program I was given to analyze, and now I am being told that I need to convert the entire program into C++, just my luck.

So there are several features that at the moment I do not understand how to convert over.
If there is someplace where I can find all of these solution pieces I would deeply appreciated it.

using namespace System

I cant seem to get this to work, i tried importing the following to make this available, but i ran into an error and according to this error it is not supported at the moment...

#using <mscorlib.dll>

Next:

internal class UserFeedback
    {
        public static void Error(Exception e)
        {

How do i do an internal class in C++? i read something about public private: but i am not really sure....

public static void class XXXXXXX

I assume I can convert this to

public:
            static void class XXXXXXX

instead, getting some answers on these things would be a great help to me and a good start, especially the system error I am running into, I am trying to access the Console commands. Any help is appreciated :)

>using namespace System
Just add a semicolon and you should be solid:

using namespace System;

How do i do an internal class in C++?

The private keyword at class level has the same semantics as internal in C#:

private ref class UserFeedback {
public:
    static void Error(Exception^ e)
    {
    }
};

Edited 5 Years Ago by Narue: n/a

Still can't get the

using namespace System;

to work, like i said above I am having issues with the following which i read online is the issue:

#using <mscorlib.dll>

Ty for the fast response :)

I am compiling it within the program itself and not using the cmd prompt version, so how would i work with the /clr switch? I could not seem to find that online, I am sorry for my dumb questions but I am coming to you after about 2-3 hrs worth of web searching on these dumb issues.

Also when I did the private ref class UserFeedback I am getting an error about no declaration coming after private. Ty for all of your help.

Project -> Properties -> Configuration Properties -> C/C++ -> General -> Common Language Run Time Support. Set it to /clr.

New error, helped fix some of the problems though

Command line error D8016: '/ZI' and '/clr' command-line options are incompatible.

So turn /ZI off. It's the option immediately above /clr. You can set it to /Zi, that's compatible.

When i do that now i get Command line error D8016: '/clr' and '/Gm' command-line options are incompatible (I don't see /gm on this same menu)

Then I changed it to gm- when i found it, and now having issue with /EHS. THere must be a common issue going on here....

Under C/C++ -> Code Generation -> Enable Minimal Rebuild. Or you could search for it and actually learn how to do this stuff on your own.

Ok well i went through each of those errors, and turned them all off, finally got it to attempt a compiliation.

Getting an error link code

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
C:\Users\Public\Documents\AOC Source\C++\AoE2Wide\Debug\AoE2Wide.exe : fatal error LNK1120: 1 unresolved complaint

Here is the code that I have so far:

AoE2Wide.cpp

#include "stdafx.h"

namespace AoE2Wide
{
    int main()
    {
        return 0;
    }
};

UserFeedback.cpp

#include "stdafx.h"
#include <iostream>
#include <mscorlib.dll>

using namespace System;

namespace AoE2Wide
{
    private ref class UserFeedback
    {
    public:
        static void Error(Exception^ e)
        { 
        }
    };
};

Ok, all fixed up, will just have to work my way through all the pieces of this C# code now that the CLR support is working properly. Thank you very much Narue :)

This question has already been answered. Start a new discussion instead.