The error message from the compiler is very clear.
getInput
is a non-static
member function of the class.
You need an object of the class to be able to use that member function.
Instead of
stats::getInput(std::cin);
use
stats obj; obj.getInput(std::cin);
Another solution.
Since the class does not have any member variables, you may change getInput
to a static
member functions.
class stats { public: stats(); static std::vector <double> getInput(std::istream& input_stream); private: };
If you do that, you may use:
stats::getInput(std::cin);
Also, your loop to read the data can be simplified to:
while (input_stream >> x){ stream.push_back(x); }
Related Posts:
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- What is a lambda expression in C++11?
- ld: symbol(s) not found for architecture x86_64 error
- What is the ‘override’ keyword in C++ used for? [duplicate]
- What is a smart pointer and when should I use one?
- Meaning of = delete after function declaration
- C++ std::priority_queue uses the lambda expression
- Usage and Syntax of std::function
- What exactly is nullptr?
- Difference between `constexpr` and `const`
- Split a string using C++11
- How to create timer events using C++ 11?
- error: expected unqualified-id error: Meaning and fix? [duplicate]
- c++ compile error: ISO C++ forbids comparison between pointer and integer
- error: redefinition of class
- C++ Error: No match for ‘operator=’
- Identifier not found error on function call
- What is an ‘undeclared identifier’ error and how do I fix it?
- What does T&& (double ampersand) mean in C++11?
- Identifier not found error on function call
- What is an ‘undeclared identifier’ error and how do I fix it?
- Segmentation fault error 11 C++
- Why doesn’t C++ have a garbage collector?
- C ++ error: a expected initializer before [function name]
- Compiling C++11 with g++
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- invalid new-expression of abstract class type
- What exactly is std::atomic?
- Issue with std::stol – ‘std::invalid_argument’ what(): stol
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- terminate called after throwing an instance of ‘std::out_of_range’
- “Symbol(s) not found for architecture x86_64” on QtCreator project
- error: redefinition of class
- Cleanest way to copy a constant size array in c++11
- push_back vs emplace_back
- C++ error: “Array must be initialized with a brace enclosed initializer”
- undefined reference to ‘std::cout’
- What is move semantics?
- expression preceding parentheses of apparent call must have (pointer-to-) function type
- C++ error: Undefined symbols for architecture x86_64
- C++ terminate called without an active exception
- Thread pooling in C++11
- error: expected primary-expression before ‘)’ token (C)
- How does std::forward work? [duplicate]
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- Difference in make_shared and normal shared_ptr in C++
- What is std::move(), and when should it be used?
- C++: std does not have member “string”
- push_back vs emplace_back
- error: use of deleted function
- Resolve build errors due to circular dependency amongst classes
- C++ error: definition of implicitly-declared
- Call to implicitly deleted copy constructor in LLVM
- extra qualification error in C++
- error C2679: binary ‘<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
- Cannot open output file, permission denied
- no match for ‘operator<<’ in ‘std::operator
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- Use the auto keyword in C++ STL
- Does C++11 have C#-style properties?
- Iterator Loop vs index loop
- Error “Unterminated conditional directive” in cross-referencing headers
- initialize a vector to zeros C++/C++11
- When is it safe to call this-> in constructor and destructor
- How to memset char array with null terminating character?
- multiple definitions error in c++ and solution to solve this issue
- Stray ‘\342’ in C++ program
- How well is Unicode supported in C++11?
- System not declared in scope?
- Error in assignment of member in read-only object
- How to automatically convert strongly typed enum into int?
- Why should I use a pointer rather than the object itself?
- too many initializers for ‘int [0]’ c++
- Call of overloaded function is ambiguous
- overloaded function with no contextual type information
- error: ISO C++ forbids in-class initialization of non-const static member
- Creating folders in C++
- convert string to size_t
- Compiling C++11 with g++
- Error: expression cannot be used as a function?
- ERROR C2039: ‘vector’: is not a member of ‘std’
- Does static constexpr variable inside a function make sense?
- c++ vector bubble sort
- Unexpected end of file error
- virtual memory exhausted: Cannot allocate memory
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- How to use bitmask?
- Differences between unique_ptr and shared_ptr
- What is a segmentation fault?
- wntdll.pdb not loaded – Can’t see the exception
- How to fix ‘std::logic_error’ what(): basic_string::_M_construct null not valid error?
- General way of solving Error: Stack around the variable ‘x’ was corrupted
- error MSB3073: How do I fix this?
- timestamp of time(0) at multiple places in a C++ program
- how to initialize an empty integer array in c++
- What does |= mean in c++
- Error: cannot declare variable ‘c’ to be of abstract type ‘circle’
- What is wrong with using goto?
- C++ compiler error: “return type specification for constructor invalid”
- Converting bool to text in C++