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]
- Is “delete this” allowed in C++?
- What is a segmentation fault?
- How many spaces for tab character(\t)?
- How to create a dynamic array of integers
- How to create a dynamic array of integers
- Linker Error C++ “undefined reference ” [duplicate]
- How do I build a graphical user interface in C++? [closed]
- C++ convert from 1 char to string?
- How do I build a graphical user interface in C++? [closed]
- convert a char* to std::string
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- How to implement 2D vector array?
- Why the switch statement cannot be applied on strings?
- How to use setprecision in C++
- How to dynamically allocate arrays in C++
- What does (~0L) mean?
- How to dynamically allocate arrays in C++
- What is the best way to use a HashMap in C++?
- What is the best way to use a HashMap in C++?
- What are the differences between a pointer variable and a reference variable in C++?
- What is an undefined reference/unresolved external symbol error and how do I fix it?
- Sleep for milliseconds
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Easiest way to convert int to string in C++
- What is the difference between float and double?
- Why is “using namespace std;” considered bad practice?
- What is the easiest way to initialize a std::vector with hardcoded elements?
- outputting ascii table in C++
- What is a lambda expression in C++11?
- Vector of Vectors to create matrix
- How to throw a C++ exception
- std::string to char*
- How to generate a random number in C++?
- pinpointing “conditional jump or move depends on uninitialized value(s)” valgrind message
- What is an undefined reference/unresolved external symbol error and how do I fix it?