我正在尝试学习C++,并尝试解决一个问题,在这个步骤中给出了许多步骤以及可以采用的步骤的数量,给出了爬上台阶的可能方法的所有排列.因此,例如,如果有5个步骤可以攀爬,我可以一次向上移动1步,一次向上移动2步,或者一次向上移动3步,我需要打印出1,2和3的所有排列,加起来5: [1, 1, 1, 1, 1]
,[1, 1, 1, 2]
....
我开始使用这段代码(它还没有完成),但是我收到了这个错误:
Undefined symbols for architecture x86_64:
"_num_steps(int, std::__1::vector<int, std::__1::allocator<int> >, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > >, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > >)", referenced from:
num_steps(int, std::__1::vector<int, std::__1::allocator<int> >) in num_steps-FTVSiK.o
ld: symbol(s) not found for architecture x86_64
Run Code Online (Sandbox Code Playgroud)
我真的不明白我做错了什么.如果我能得到一些帮助,我会很感激.谢谢!
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
//prototypes
void _num_steps(int amount, vector<int> possible_steps, vector<vector<int>> steps_list, vector<vector<int>> result);
int sum(vector<int> steps_list);
void num_steps(int …
Run Code Online (Sandbox Code Playgroud)