0
"check or define function %c_a_ce for overloading"

Good afternoon,

I'm facing a problem which I can't understand.

I do exec loader.sce and the files does not run until de end because it says that I should 'define function %c_a_ce'. And I really can't understand why.

I will send in below the email the code writen in the file 'loader.sce' in order to be easier to find out the problem.

"-> // Working directory

--> wdir = pwd();


--> // Loading blocks

--> mprintf(gettext("Loading blocks...\n"));
Loading blocks...


--> loadXcosLibs();


--> toolbox_dir = pathconvert(wdir);

--> // All the available block

--> names = {'Pipe','Junction','Reservoir'};

--> interfaces = names;


--> sciFiles = pathconvert(wdir) + interfaces + ".sci";
in builtin exec( C:\Users\tiago.soares\Downloads\Hydraulic_toolbox\loader.sce line -1 )

Undefined operation for the given operands.
check or define function %c_a_ce for overloading."

The loader.sce file is:

'

/ Load a palette in the Xcos environment
clc

// Working directory
wdir = pwd();

// Loading blocks
mprintf(gettext("Loading blocks...\n"));

loadXcosLibs();

toolbox_dir = pathconvert(wdir);
// All the available block
names = {'Pipe','Junction','Reservoir'};
interfaces = names;

sciFiles = pathconvert(wdir) + interfaces + ".sci";
h5_instances = toolbox_dir + "/images/h5/" + interfaces + ".sod";
pal_icons = toolbox_dir + "/images/png/" + interfaces + ".png";
graph_icons = toolbox_dir + "/images/svg/" + interfaces + ".svg";
// graph_icons = interfaces + ".svg";

xpal = xcosPal("WDS");

for i=1:size(interfaces,2)
    // Load the interface function
    exec(sciFiles(i), -1);
    
    // register to the palette.
    style = struct();
    // protect drive letter
    block_img =  graph_icons(i);
    if getos() == "Windows" then
        block_img = "/" + block_img;
    end
    style.image = "file://" + block_img;
    xpal = xcosPalAddBlock(xpal, h5_instances(i), pal_icons(i), style);
end

xcosPalAdd(xpal);

global %MODELICA_USER_LIBS;
%MODELICA_USER_LIBS = [%MODELICA_USER_LIBS ; pathconvert(wdir)];'


Scilab 26-03-21, 7:32 p.m. TiagoFloating
0

Function overloading is a C++ programming feature that allows us to have more than one Now that we know what is parameter list lets see the rules of overloading: we can have All of the above three cases are valid case of overloading.

TargetPayandBenefits Login

27-03-21, 12:55 p.m. DonaldFlores

Function overloading Example

Lets take an example to understand function overloading in C++.

#include <iostream>
using namespace std;
class Addition {
public:
    int sum(int num1,int num2) {
        return num1+num2;
    }
    int sum(int num1,int num2, int num3) {
       return num1+num2+num3;
    }
};
int main(void) {
    Addition obj;
    cout<<obj.sum(20, 15)<<endl;
    cout<<obj.sum(81, 100, 10);
    return 0;
}

Output:

35
191

Function overloading Example 2

As I mentioned in the beginning of this guide that functions having different return types and same parameter list cannot be overloaded. However if the functions have different parameter list then they can have same or different return types to be eligible for overloading. In short the return type of a function
does not play any role in function overloading. All that matters is the parameter list of function.

#include <iostream>
using namespace std;
class DemoClass {
public:
    int demoFunction(int i) {
        return i;
    }
    double demoFunction(double d) {
        return d;
    }
};
int main(void) {
    DemoClass obj;
    cout<<obj.demoFunction(100)<<endl;
    cout<<obj.demoFunction(5005.516);
   return 0;
}

Output:

100
5006.52

 

Oops! Looks like spam! Waiting for moderator approval.

31-05-21, 1:14 a.m. tommyshelbyop

Login to add comment


0
Thank you very much for your reply, so do you have any ideia what could be the problem?
29-03-21, 4:47 p.m. TiagoFloating


0
Maybe confusion somewhere or the required value has not been determined, try referencing this web impostor configuration because I think it is quite similar.
30-03-21, 8:05 a.m. alucca


0
I've already understand that the problem is referred in this line 'sciFiles = pathconvert(wdir) + interfaces + ".sci";'. It's because it can't run a matrix/array like is code writen, can you please tell me if there if it's normal in C to right it that way? To me, the only way it could works is through iterations but I don't know if in C it's already prepared to receive the code like that. Thank you in advance
30-03-21, 2:04 p.m. TiagoFloating


Log-in to answer to this question.