对 'list' 的引用不明确,包括 header 文件
reference to 'list' is ambiguous including header file
当我添加“bits/stdc++.h”header 文件时,它显示 [Error] 对 'list' 的引用不明确。但是当我擦除 header 并保留所有其他 header 时,代码编译正确。
#include <bits/stdc++.h>
#include<stdio.h>
#include <iostream>
#include<stdlib.h>
#include <string.h>
#include <sstream>
#define LIST_INIT_SIZE 2
#define NULL_VALUE -99999
#define SUCCESS_VALUE 99999
using namespace std;
int listMaxSize;
int * list;
int length;
void initializeList()
{
listMaxSize = LIST_INIT_SIZE;
list = (int*)malloc(sizeof(int)*listMaxSize) ;
length = 0 ;
}
那是因为 header <bits/stdc++.h>
有自己的列表版本,即来自列表模板 <list>
。
有两个副本或相同的不同定义会导致歧义。
如果它在没有位 header (STL) 的情况下工作,那么就不要使用它。
当我添加“bits/stdc++.h”header 文件时,它显示 [Error] 对 'list' 的引用不明确。但是当我擦除 header 并保留所有其他 header 时,代码编译正确。
#include <bits/stdc++.h>
#include<stdio.h>
#include <iostream>
#include<stdlib.h>
#include <string.h>
#include <sstream>
#define LIST_INIT_SIZE 2
#define NULL_VALUE -99999
#define SUCCESS_VALUE 99999
using namespace std;
int listMaxSize;
int * list;
int length;
void initializeList()
{
listMaxSize = LIST_INIT_SIZE;
list = (int*)malloc(sizeof(int)*listMaxSize) ;
length = 0 ;
}
那是因为 header <bits/stdc++.h>
有自己的列表版本,即来自列表模板 <list>
。
有两个副本或相同的不同定义会导致歧义。
如果它在没有位 header (STL) 的情况下工作,那么就不要使用它。