I have these two header files and one produces an error if I don’t put std:: in front of all string declarations and the other doesn’t. I was just wondering what the difference between the two was.
The following will produce an error if the std:: is not in front of the string declarations:
#include <string>
#include <vector>
#pragma once
#ifndef DATABASE_H
#define DATABASE_H
struct Item
{
public:
std::string object;
int numOfColors;
std::string colors;
int sizeSmall;
int sizeLarge;
};
class database
{
private:
void fillDatabase(std::vector<Item>);
public:
void getDatabase(std::vector<Item>);
};
#endif
The following code will not produce an error:
#include <string>
#pragma once
#ifndef GUISTRUCT_H
#define GUISTRUCT_H
struct guiValues
{
public:
string shape;
string color;
int width;
double squareProbability;
double rectangleProbability;
double circleProbability;
string firstMostLikelyObject;
double FMLOprobability;
string secondMostLikelyObject;
double SMLOprobability;
string thirdMostLikelyObject;
double TMLOprobability;
};
#endif
The second file is included after some other that defines