showInventory(player);
is passing a type as parameter. That’s illegal, you need to pass an object.
For example, something like:
player p; showInventory(p);
I’m guessing you have something like this:
int main() { player player; toDo(); }
which is awful. First, don’t name the object the same as your type. Second, in order for the object to be visible inside the function, you’ll need to pass it as parameter:
int main() { player p; toDo(p); }
and
std::string toDo(player& p) { //.... showInventory(p); //.... }
Related Posts:
- Why do we need virtual functions in C++?
- Parse (split) a string in C++ using string delimiter (standard C++)
- What are the rules of the std::cin object in C++?
- C++ code file extension? What is the difference between .cc and .cpp
- C++ Error: ISO C++ Forbids Comparison Between Pointer and Integer [-fpermissive]
- Writing a very simple lexical analyser in C++
- segmentation fault 11 in C++ on Mac
- How to append text to a text file in C++?
- In C++, what is wx.h?
- Using “super” in C++
- new types may not be defined in a return type – C++
- declaring a priority_queue in c++ with a custom comparator
- C++ undefined reference to WinMain@16 (Code::Blocks)
- bit vectors in c++
- Very basic inheritance: error: expected class-name before ‘{’ token
- mkdir c++ function
- Error: “expected primary-expression before int”
- Operator Overloading C++; too many parameters for << operation
- How do I check if a Key is pressed on C++
- How to not-analyze in ElasticSearch?
- When is K 1024 and when is it 1000?
- Dial pad to get phone number (with Android button images)
- Why is it not possible to fake an IP address?
- Pause Console in C++ program
- Why the switch statement cannot be applied on strings?
- How does strtok() split the string into tokens in C?
- How do I get my C# program to sleep for 50 msec?
- What is an idiomatic way of representing enums in Go?
- Why the range of int is -32768 to 32767?
- syntaxerror: “unexpected character after line continuation character in python” math
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- C++ Error: undefined reference to `main’
- 1.#QNAN error C++
- What is the array form of ‘delete’?
- Error: Expression must have integral or unscoped enum type
- Use new operator to initialise an array
- Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio
- What does “<<" and ">>” mean in C++ for cout/cin?
- C ++ error: a expected initializer before [function name]
- invalid new-expression of abstract class type
- Parsing a comma-delimited std::string
- what is the difference between OLE DB and ODBC data sources?
- Correct way of looping through C++ arrays
- C++ how to read a line with delimiter until the end of each line?
- Random number c++ in some range
- What’s the equivalent of new/delete of C++ in C?
- What’s the syntax for declaring an array of function pointers without using a separate typedef?
- Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)
- C++ cannot open source file
- What is the difference between const_iterator and non-const iterator in the C++ STL?
- Background color for Tk in Python
- how to uninstall MinGW and make cygwin ‘make’ as deafult make program with gcc 3.8.1
- Sorting Linked List C++ with pointers
- Get Unix timestamp with C++
- Class prototyping
- Cosine similarity and tf-idf
- 8 queens puzzle with user input c++
- How to dynamically allocate an array of pointers in C++?
- Remove First and Last Character C++
- Error “The goal you specified requires a project to execute but there is no POM in this directory” after executing maven command
- C++ Convert string (or char*) to wstring (or wchar_t*)
- Program received signal SIGSEGV, Segmentation fault
- Error in glm() in R
- What is a good Hash Function?
- Excel Filters – show only relevant values in the filter
- Integer to hex string in C++
- Comparison of C++ unit test frameworks
- Remove node_modules from git in vscode
- Trying to use int in getline
- How do you change session timeout in IIS 8.5?
- What is the difference between an Abstract Data Type(ADT) and a Data Structure?
- What does the term “empty loop” refer to exactly in C and C++?
- c++ error c2015: too many characters in constant
- Splitting a C++ std::string using tokens, e.g. “;”
- How to do std::string indexof in C++ that returns index of matching string?
- How to print variable in sml?
- variable or field declared void
- Invalid conversion from ‘char’ to ‘const char *’
- How do I deal with “signed/unsigned mismatch” warnings (C4018)?
- Why is the minidlna database not being refreshed?
- How do you convert an entire directory with ffmpeg?
- heap corruption detected | C++
- What’s the difference between sx and σx in the statistics calculations on a TI-Nspire?
- Update g++ but still old version
- database collation differences
- Add Woocommerce product to cart with Contact Form 7 [closed]
- A Compare And Distinction Essay Define To Beat Writer’s Block
- 27 Outstanding Faculty Essay Examples
- The Way To Write An Essay Outline In Four Steps
- To remove rendering of menus and header, plugin or theme?
- What are the obstacles to providing reliable Internet access and Wi-Fi at large tech conferences? [closed]
- How to start/stop/restart launchd services from the command line?
- Why is DNS failover not recommended?
- How bad is IPv4 address exhaustion really?
- Is it possible to generate RSA key without pass phrase?
- Find the location of a systemd unit file service
- What does Apache’s “Require all granted” really do?
- Engineers are using explosives to remove hard rock outside our office building. What countermeasures should we take?
- How do you increase a KVM guest’s disk space?
- How can the little guys effectively learn and use Puppet? [closed]