Hello I am trying to compile an application that I wrote (and it compiles) on an Ubuntu machine.
When I compile it on a FreeBSD machine it tells me this anytime I try to use SSTR
Thanks for any advice I can get
To make it as simple as I can
compile
error is
When I compile it on a FreeBSD machine it tells me this anytime I try to use SSTR
Code:
error: non-const lvalue refference to type 'basic_ostringstream<...>' cannot bind to a temporary of type 'basic_ostringstring<...>
Code:
#include <sstream>
#define SSTR( x ) static_cast< std::eek:stringstream & >(( std::eek:stringstream() << std::dec << x ) ).str()
Thanks for any advice I can get
To make it as simple as I can
Code:
#include <iostream>
#include <sstream>
#include <string>
#define SSTR( x ) static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << x ) ).str()
using namespace std;
int main()
{
int iTest = 789;
cout << SSTR(iTest) << endl;
return 0;
}
compile
Code:
c++ -Wall -std=c++11 -fexceptions -std=c++11 -g -Iinclude -c main.cpp -o main.o
error is
Code:
main.cpp:12:13: error: non-const lvalue refrence to type
'basic_ostringstream<...>' cannot bind to a temporary of type
'basic_ostringstream<...>'
cout << SSTR(iTest) << endl;
main.cpp:5:19: note: expanded from macro 'SSTR'
... static_cast< std::ostringstream & > (( std::ostringstream() << std::dec << x)...
~~
1 error generated.