473,480 Members | 2,194 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Converting Int to String...

For some reason the following code is not compiling.
void Find_score(void)
{
glColor3f(1.0,0.0,0.0);
std::ostringstream ostr; //turn int score into a string
ostr << score; //score is defined some where
else
std::string LL = ostr.str();
glRasterPos3f (4.5F, -5.5F, 1.0F);
for(int i=0;i<=10;i++) //its never going to have more than 10
digits
{
switch(LL[i]) //if first number in score is one, draw
1...etc.
{
case '1':
drawString ("1"); //drawstring function is
declared somewhere else
break;
case '2':
drawString ("2");
break;
case '3':
drawString ("3");
break;
case '4':
drawString ("4");
break;
case '5':
drawString ("5");
break;
case '6':
drawString ("6");
break;
case '7':
drawString ("7");
break;
case '8':
drawString ("8");
break;
case '9':
drawString ("9");
break;
case '0':
drawString ("0");
break;
}
}
glRasterPos3f (4.0F, -5.5F, 1.0F);
drawString ("Points:");
}

The only error i get is " aggregate `std::ostringstream ostr' has
incomplete type and cannot be defined " and i don't get why its doing
that. Can someone tell me what that means?

Sep 3 '05 #1
2 2355
bballmitch wrote:
For some reason the following code is not compiling.
void Find_score(void)
{
glColor3f(1.0,0.0,0.0);
std::ostringstream ostr; //turn int score into a string
ostr << score; //score is defined some where
else
std::string LL = ostr.str();
glRasterPos3f (4.5F, -5.5F, 1.0F);
for(int i=0;i<=10;i++) //its never going to have more than 10
digits
{
switch(LL[i]) //if first number in score is one, draw
1...etc.
{
case '1':
drawString ("1"); //drawstring function is
declared somewhere else
break;
case '2':
drawString ("2");
break;
case '3':
drawString ("3");
break;
case '4':
drawString ("4");
break;
case '5':
drawString ("5");
break;
case '6':
drawString ("6");
break;
case '7':
drawString ("7");
break;
case '8':
drawString ("8");
break;
case '9':
drawString ("9");
break;
case '0':
drawString ("0");
break;
}
}
glRasterPos3f (4.0F, -5.5F, 1.0F);
drawString ("Points:");
}

The only error i get is " aggregate `std::ostringstream ostr' has
incomplete type and cannot be defined " and i don't get why its doing
that. Can someone tell me what that means?


You didn't include <sstream>, most likely.

V
Sep 3 '05 #2
oh yeah. :P my bad. that was stupid. thanks

Sep 3 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3287
by: Cyde Weys | last post by:
I'm currently working on converting a simulator program from Visual Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but there's still one thing I haven't gotten to and I've never...
9
2564
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
13
3933
by: Paraic Gallagher | last post by:
Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying...
3
28514
by: Wallace | last post by:
Hai, Can anyone tell how to convert an object into string? Please help me.... urgent.. Thanx in advance...
4
3170
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
9
2532
by: Terry | last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces. One of the major uses is to be able to split out Read-only access to an obect. Let me give you a simple (contrived)...
5
23441
by: SMichal | last post by:
Hi, how can I parse string "? 20.000" to double ?
3
2376
by: nvx | last post by:
Hi, I'm looking for a simple way to convert a Double to a String exactly the .ToString() does, except these two differences: - the number of decimals is given (rounding is applied if necessary),...
2
3985
by: CoreyWhite | last post by:
Problem: You have numbers in string format, but you need to convert them to a numeric type, such as an int or float. Solution: You can do this with the standard library functions. The...
10
3211
by: Hank Stalica | last post by:
I'm having this weird problem where my code does the following conversion from string to float: 27000000.0 -27000000.00 2973999.99 -29740000.00 2989999.13 -2989999.25 The number on the left...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5357
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4495
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.