I have no idea about what's wrong here.
std::stringstream ss("Title");
ss << " (" << 100 << ")";
const char* window_title = &ss.str().c_str();
I've ran make
and it was not happy.
[17%] Building CXX object CMakeFiles/game.dir/src/main.cpp.o
path: error: cannot take the address of an rvalue of type 'const value_type *'
(aka 'const char *')
const char* window_title = &ss.str().c_str();
^~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/game.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/game.dir/all] Error 2
make: *** [all] Error 2
From what I understand, I'm creating a stringstream
with the word "Title" and then appending "(100)" to it. After this, I am retrieving a string, then a "C string", which is a char
and storing the pointer to that in window_title
.
What's wrong?