The return type for stringThing
must be either void
or string
, not both. You also must include <string>
, if you want to use string.
Since you want to output the return value of stringThing()
in main
, I guess it should be
std::string stringThing (std::string shiftdir, const std::string &teststring)
But then, you must also return a string from your function
if (shiftdir == "right") return teststring + " " + "Bit Shifted right"; else return teststring + " " + "Bit Shifted left";
for example.
Your parameter std::string &teststring
won’t work with your const char*
argument. So either declare it as a copy by value string
only, or better const string&
.
Related Posts:
- What is the difference between g++ and gcc?
- g++ ld: symbol(s) not found for architecture x86_64
- Convert char to int in C and C++
- 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
- Undefined reference to vtable
- Expected initializer before function name
- Inheriting constructors
- What is an ‘undeclared identifier’ error and how do I fix it?
- Identifier not found error on function call
- What is an ‘undeclared identifier’ error and how do I fix it?
- Undefined reference to vtable
- Inheriting constructors
- invalid new-expression of abstract class type
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- “Symbol(s) not found for architecture x86_64” on QtCreator project
- error: redefinition of class
- C++ error: “Array must be initialized with a brace enclosed initializer”
- undefined reference to ‘std::cout’
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- MinGW: “gcc is not recognized as an internal or external command”
- error: expected primary-expression before ‘)’ token (C)
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- Compiling a C++ program with gcc
- gcc/g++: “No such file or directory”
- error: use of deleted function
- Resolve build errors due to circular dependency amongst classes
- C++ error: definition of implicitly-declared
- CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- cannot declare variable ‘’ to be of abstract type ‘’
- extra qualification error in C++
- Debug vs Release in CMake
- Debug vs Release in CMake
- Cannot open output file, permission denied
- What does the fpermissive flag do?
- gcc: undefined reference to
- Call to non-static member function without an object argument compiler error
- Update GCC on OSX
- Error “Unterminated conditional directive” in cross-referencing headers
- GCC -fPIC option
- multiple definitions error in c++ and solution to solve this issue
- Stray ‘\342’ in C++ program
- gcc -g :what will happen
- System not declared in scope?
- Error in assignment of member in read-only object
- Call of overloaded function is ambiguous
- Warning : overflow in implicit constant conversion
- error: ISO C++ forbids in-class initialization of non-const static member
- cc1.exe System Error – libwinpthread-1.dll missing – But it isn’t
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- How to Check the Version of my gcc?
- Make / gcc cryptic error 2: how to have more information?
- Error: expression cannot be used as a function?
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- Unexpected end of file error
- virtual memory exhausted: Cannot allocate memory
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- Making my own toString() method on c++ struct
- Struct Constructor in C++?
- What is meant with “const” at end of function declaration? [duplicate]
- error: lvalue required as unary & operand
- What is use of c_str function In c++
- Is there a decent wait function in C++?
- What does T&& (double ampersand) mean in C++11?
- C++ – No matching member function for call to ‘push_back’
- error: lvalue required as unary & operand
- Using O_RDWR vs O_RDONLY | O_WRONLY
- How to implement the factory method pattern in C++ correctly
- c++ array – expression must have a constant value
- getline() does not work if used after some inputs
- Passing a 2D array to a C++ function
- ‘typeid’ versus ‘typeof’ in C++
- Thread pooling in C++11
- Undefined reference to class constructor, including .cpp file fixes
- Deleting a dynamically allocated 2D array
- How to add element to C++ array?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- Error: Jump to case label in switch statement
- What is the preferred way to include error messages in C++?
- How to Convert a C++ String to Uppercase
- C++ Fractions Class
- #pragma once vs include guards?
- Reference to non-static member function must be called
- How can I assign an array from an initializer list?
- I get this error: “glibc detected”
- How can I get and use the header file
in my C++ program? - cin.eof() functionality
- Implementing a tree in C++
- got “cannot appear in a constant-expression” when using template
- C++ ostream and ofstream conversions
- C++ discards qualifiers
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- C++ : Exception occurred in script: basic_string::_S_construct NULL not valid
- Multiple inputs on one line
- Why do I get: -9223372036854775808
- Getting the error floating point exception: 8