tags:

views:

100

answers:

2

I am learning C++/CLI and attempting to build an Interop component for my C# project. I'm not sure what this error means or how to resolve it? Any ideas?

#pragma once

using namespace System;

namespace Firewall {

    public ref class Firewall
    {
        void StartFirewall(){};
    }
}
+10  A: 

Unlike C#, C++ requires a semicolon after a type definition.

public ref class Firewall
{
    void StartFirewall(){} // doesn't require semicolon here
}; // needs semicolon here.

In C#, you can actually have semicolons after type definitions (not recommended though) and that will be ignored. It is there for the sake of consistency with C++ syntax.

Mehrdad Afshari
Awesome, thanks!
George
+2  A: 

There is no need to have the ; in the place you currently have it. Instead place it after the closing } of the class Firewall.

public ref class Firewall
{
    void StartFirewall(){}
};
JaredPar