Results 1 to 3 of 3

Thread: Expected ; or =(cannot specify constructor arguments in declaration)

Hybrid View

  1. #1
    New Member
    Join Date
    Aug 12
    Location
    Bangalore, India
    Posts
    2

    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

    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.

  2. #2
    Fanatic Member
    Join Date
    Jan 06
    Posts
    515

    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
    Last edited by David Anton; Aug 4th, 2012 at 01:34 PM.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  3. #3
    New Member
    Join Date
    Aug 12
    Location
    Bangalore, India
    Posts
    2

    Re: Expected ; or =(cannot specify constructor arguments in declaration)

    Hiya

    Thanks for that, but it didn't work either.

    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.

    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.


    With regards,
    A budding programmer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •