very new to C++.
Here is my user defined fmiNode class: (fmi.h)
class fmiNode
{
public:
fmiNode(std::string NodeName,int Address)
{
this->name = NodeName;
this->address = Address;
}
std::string GetName()
{
return this->name;
}
int GetAddress()
{
return this->address;
}
private:
std::string name;
int address;
};
Here is my main method (fmi.c)
int main (int argc, char *argv[])
{
fmiNode node1("NodeA",4);
fmiNode node2("NodeB",6);
fmiNode node3("NodeC",8);
fmiNode node4("NodeD",10);
while(1)
{
MainLoop();
}
}
If I only instantiate one fmiNode object everything is fine. but the following 3 causes a warning to be thrown:
warning: inlining failed in call to ‘fmiNode::fmiNode(std::string, int)’: call is unlikely and code size would grow [-Winline]
What am I doing wrong here.
EDIT:
So I should define my class like this:?
class fmiNode
{
public:
fmiNode(std::string NodeName,int Address);
std::string GetName()
{
return this->name;
}
int GetAddress()
{
return this->address;
}
private:
std::string name;
int address;
};
fmiNode::fmiNode(std::string NodeName,int Address)
{
this->name = NodeName;
this->address = Address;
}
Cheers, Rhys