I'm trying to instantiate a class written in C++ from python. For some reason, I'm getting a syntax error when invoking the "print" method, which takes no argument and should just print an int:
IronPython 2.7.5b2 (2.7.5.0) on .NET 4.0.30319.18444 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReferenceToFileAndPath('c:\\users\\pletzer\\documents\\visual studio
>>> \\Projects\\AlexTest\\Debug\\AlexTest.dll')
>>> import at
>>> a = at.AlexTest(2)
>>> a.print()
File "<stdin>", line 1
a.print()
^
SyntaxError: syntax error
Thanks in advance for any suggestion. The C++ class is
// AlexTest.h
#include <iostream>
#pragma once
using namespace System;
namespace at {
public ref class AlexTest
{
public:
AlexTest(int i) {
mi = i;
}
void print() {
std::cout << "mi = i\n";
}
private:
int mi;
};
}