Expected ; or =(cannot specify constructor arguments in declaration)
hi,
I've been trying to work on NXopen(NX is a cad software). I'm using c# codes for that. For opening a new file in NX this is the syntax which has been given
int UF_PART_new
(
const char * part_name,
int units,
tag_t * part
)
This is the code I made in Visual Studio
//TODO: Add your application code here
const char *part_name=@"D:\\rahul\\assignments\\extrude1.prt";
tag_t part= NULL_TAG;
int units=1;
int UF_PART_new(part_name,units,&part)
Now I'm getting errors like:confused:
Expected ; or =(cannot specify constructor arguments in declaration)
; expected
both are on "int UF_PART_new(part_name,units,&part)" line. Please someone help me on this.:mad:
Re: Expected ; or =(cannot specify constructor arguments in declaration)
You say you're using C#, but the code you have is C++ - unless you're intending to use unsafe C# code, which usually isn't necessary.
The C# code would be:
Code:
string part_name=@"D:\\rahul\\assignments\\extrude1.prt";
tag_t part= NULL_TAG;
int units=1;
int test = UF_PART_new(part_name, units, part);
For C++ code or unsafe C# code, I think all you're missing is that you either need:
Code:
int test = UF_PART_new(part_name, units, &part); //use return value
or:
Code:
UF_PART_new(part_name, units, &part); //ignore return value
Re: Expected ; or =(cannot specify constructor arguments in declaration)
Hiya
Thanks for that, but it didn't work either.:thumb:
I'm completely novice to c++ or c# programming, but I can understand the concepts, the only hurdle is "which element needs to used where" concepts.:confused:
Can you pls explain how did you tell that my codes are in c++ and not in c#(I was thinking them to be c# codes:(). And what do you mean by unsafe c# codes ?
If you can then kindly let me know whether I can be in touch with you through personal messages so that I can solve my doubts then and there. :wave:
With regards,
A budding programmer. :sick: