RE: VSE2010 with GTKmm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, run was meant to be num, it was a typo.
This is the last incarnation of that template function:
template <class T>
const std::string toString(const T & data){
  std::stringstream num(std::stringstream::out);
  num << data;
  return num.str();
}
Nevertheless, the application compiles and runs as expected, as long as the gtkmm property sheet is not added to the project, otherwise, the application crashes. I have been testing gui-toolkits for the past few weeks and none delivered what they promised. They don't install properly or they don't run properly, and some even leak badly. Microsoft GUIs are a bit complicated and bulky, but, like Java, it delivers what it says it will.
Some times I don't understand why I put myself in these situations, where I am testing and trouble shooting other people's applications, when all I want to do is write code and trouble shoot *my own applications*.
I am a sucker for punishment I guess.

-----Original Message-----
From: Nick [mailto:nospam@xxxxxxxxxxxxxxx] 
Sent: Tuesday, February 12, 2013 6:52 PM
To: ArbolOne
Cc: 'Syed Ahsan Ali Bokhari'; 'Ian Lance Taylor'; 'Jonathan Wakely'; gcc-help@xxxxxxxxxxx; 'Andrew Haley'
Subject: Re: VSE2010 with GTKmm

This is a C++ issue, not a GCC issue.

On Tue, 2013-02-12 at 16:30 -0500, ArbolOne wrote:
> There is no problem with the code.
Looks like problematic code to me.

This function is returning a reference to an object, but the implementation is returning a temporary.

Additionally, line 5 lists a variable 'run' which isn't declared anywhere in your sample.


> #include <iostream>
> 
> 1. template< typename T>
> 2. std::string& toString(const T& data){
> 3.   std::stringstream num(std::stringstream::out);
> 4.   num << data;
> 5.   return run.c_str();
> 6. }
> 
> However, an error is triggered by line 3. This error started happening as soon as I added the GTKmm property sheet. If I remove the property sheet from the project, then the applicatin compiles without any problem.

If you're looking for an output string stream, consider using a std::ostringstream.

> So, the problem is the gtkmm and not VC++ or the IDE in my Win7.
> Is there anyone here having the same problem?


Nick






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux