在我的代码中Main.cpp
我有如下所示的内容。我遇到的问题是 tuple<int, int, int>
我不断收到这三个错误
function "sPA" returns incomplete type "trie"
, incomplete type is not allowed
, 和
cannot convert to incomplete class "trie"
我在这里做错了什么会犯这个错误?
// Main.cpp
#include <iostream>
#include <string>
using namespace std;
typedef pair<int, int> int_pair;
typedef tuple<int, int, int> trie;
int_pair sum_and_product(int a, int b) {
return int_pair(a + b, a * b);
}
trie sPA(int a, int b, int c) {
trie t{ a + b + c,a * b * c,((a + b + c) / 3) };
return t;
}
void consuming_templates() {
int a = 2, b = 3, c = 4;
auto results = sum_and_product(a,b);
cout << "sum = " << results.first << "|product = " << results.second << endl;
auto r2 = sPA(a, b, c);
}
int main(int argc, char* argv[]) {
consuming_templates();
return 0;
}
最佳答案
idclev 463035818 和 M.M 发表评论来回答我的问题
你需要做#include <tuple>
和#include <utility>
关于c++ - 类型不完整错误(E0409、E0070、E0515),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60310208/