Aug 24, 2021 at 5:03pm
Hi, working with trying to get a function within a function to work. I get the following result:
Error C3861 'printLines': identifier not found
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
void functionSetvals(std::vector<float>&m, std::vector<float>&b)
{
m[3] = 6; //arbitrary
b[3] = 3;
printLines(m, b);
}
void printLines(std::vector<float>&m, std::vector<float>&b)
{
Std::cout << "Hello Universe"<<std::endl;
Std::cout << m[3]<<std::endl;
Std::cout << b[3]<<std::endl;
}
Main:
...
std::vector<float> m(4, 0.0f); //
std::vector<float> b(4, 0.0f);
functionSetvals(m,b);
...
|
Last edited on Aug 24, 2021 at 5:06pm
Aug 24, 2021 at 5:17pm
Declare the function before its use.
1 2 3 4 5 6 7 8 9 10 11 12
|
void printLines(std::vector<float>&m, std::vector<float>&b);
void functionSetvals(...)
{
// ...
printLines(m, b);
}
void printLines(std::vector<float>&m, std::vector<float>&b)
{
// ...
}
|
Last edited on Aug 24, 2021 at 5:18pm