You must Sign In to post a response.
  • Category: Visual Studio

    Error in executing dll file

    Dear reviewers,
    I wrote a code using MATLAB software and converted it to Dll to use in the Visual Studio environment. After adding it to the references section (springBOD and springBODNative), two errors occurred on the last line. The code I wrote for calling the Dll is as follows:

    string[] NS = new string[3] { "f1", "f2", "f3" };
    string s1, s2, s3;
    private void bODToolStripMenuItem1_Click(object sender, EventArgs e)
    {
    springBODNative.spBOD BOD1 = new springBODNative.spBOD();
    BOD1.springBOD(s1, s2, s3);
    }
    It should be noted that this code uses three input images to execute.
    The errors are as follows:
    - Error 1 The best overloaded method match for 'springBODNative.spBOD.springBOD(int, object, object)' has some invalid arguments D:\Thesis 1397\software\WQDM2\WQDM2\WQM.cs 28 13 WQDM2.
    - Error 2 Argument 1: cannot convert from 'string' to 'int' D:\Thesis 1397\software\WQDM2\WQDM2\WQM.cs 28 28 WQDM2

    I will be so thankful for any help.
  • #770014
    Your passing parameters s1, s2, s3 of type all string to BOD1.springBOD function but this function takes first parameter as int, 2nd and 3rd parameters as object type so you have pass what type of parameters function asks so if you pass int, object, object parameters then these above 2 errors will not come. errors clearly telling there is no function which takes all three parameters of type string.

    private void bODToolStripMenuItem1_Click(object sender, EventArgs e)
    {
    springBODNative.spBOD BOD1 = new springBODNative.spBOD();
    BOD1.springBOD(s1, s2, s3); // pass int parameter, pass object parameter, pass object parameter
    }


  • Sign In to post your comments