Click here to Skip to main content
16,005,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSend informations to a splitter windows (List View)) Pin
Francis B.25-Aug-01 14:17
Francis B.25-Aug-01 14:17 
GeneralRe: Send informations to a splitter windows (List View)) Pin
Ben Burnett26-Aug-01 9:40
Ben Burnett26-Aug-01 9:40 
GeneralReading CD TOC under Win98 Pin
25-Aug-01 11:48
suss25-Aug-01 11:48 
GeneralUsing ListBox.AddItem in Modal Dialog Pin
25-Aug-01 10:35
suss25-Aug-01 10:35 
GeneralRe: Using ListBox.AddItem in Modal Dialog Pin
Carlos Antollini25-Aug-01 10:56
Carlos Antollini25-Aug-01 10:56 
GeneralRe: Using ListBox.AddItem in Modal Dialog Pin
Igor Sukhov25-Aug-01 11:19
Igor Sukhov25-Aug-01 11:19 
GeneralRe: Model and Modeless dialog! Pin
Masaaki Onishi25-Aug-01 15:32
Masaaki Onishi25-Aug-01 15:32 
GeneralSTL question Pin
25-Aug-01 10:32
suss25-Aug-01 10:32 
I have rarely used any STL in my 2 years of c++, but I wanted to learn a bit more about it, so I started by reading the one chapter in Deitel and Deitel on it. But my first example from that book generated a bizare error in MSVC. Does MSVC support STL properly and do I need to do something especial? Or is
my book too old and the STL standards changed too much since this book was written in 1997.

Here is the code:

#include <iostream.h>
#include <iterator>

using namespace std;

int main()
{

cout << "Enter two integers.";

istream_iterator< int > inputInt( cin );
int number1, number2;

number1 = *inputInt; //read first int from standard input
++inputInt; //move iterator to next input value
number2 = *inputInt; //read next int from standard input

cout << "The sum is : ";

ostream_iterator <int> outputInt(cout);

*outputInt = number1 + number2;
cout << endl;
return 0;
}

And here are the 2 errors:

Compiling...
main.cpp
c:\C++\STL\Fig205\main.cpp(14) : error C2664: '__thiscall std::istream_iterator<int,char,struct std::char_traits<char=""> >::std::istream_iterator<int,char,struct std::char_traits<char=""> >(class std::basic_istream<char,struct std::char_traits<char=""> > &)
' : cannot convert parameter 1 from 'class istream_withassign' to 'class std::basic_istream<char,struct std::char_traits<char=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
c:\C++\STL\Fig205\main.cpp(23) : error C2664: '__thiscall std::ostream_iterator<int,char,struct std::char_traits<char=""> >::std::ostream_iterator<int,char,struct std::char_traits<char=""> >(class std::basic_ostream<char,struct std::char_traits<char=""> > &,
const char *)' : cannot convert parameter 1 from 'class ostream_withassign' to 'class std::basic_ostream<char,struct std::char_traits<char=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
Error executing cl.exe.

Fig205.exe - 2 error(s), 0 warning(s)
GeneralRe: STL question Pin
Igor Sukhov25-Aug-01 11:25
Igor Sukhov25-Aug-01 11:25 
GeneralSettings Files Pin
Peter Liddle25-Aug-01 7:46
Peter Liddle25-Aug-01 7:46 
GeneralRe: Settings Files Pin
Ravi Bhavnani25-Aug-01 7:58
professionalRavi Bhavnani25-Aug-01 7:58 
GeneralRe: Settings Files Pin
Anders Molin25-Aug-01 9:01
professionalAnders Molin25-Aug-01 9:01 
GeneralRe: Settings Files Pin
Carlos Antollini25-Aug-01 10:35
Carlos Antollini25-Aug-01 10:35 
GeneralRe: Settings Files Pin
Christian Graus25-Aug-01 12:16
protectorChristian Graus25-Aug-01 12:16 
GeneralGetWindowText and processes Pin
25-Aug-01 3:05
suss25-Aug-01 3:05 
GeneralRe: GetWindowText and processes Pin
Paolo Messina25-Aug-01 5:53
professionalPaolo Messina25-Aug-01 5:53 
GeneralRe: GetWindowText and processes Pin
Paul A. Howes25-Aug-01 8:33
Paul A. Howes25-Aug-01 8:33 
GeneralKeyboard Oem scan codes Pin
24-Aug-01 22:36
suss24-Aug-01 22:36 
QuestionMakeing changes to static text background color and text color?? Pin
Bryan Tyson24-Aug-01 21:46
Bryan Tyson24-Aug-01 21:46 
AnswerRe: Makeing changes to static text background color and text color?? Pin
Michael Dunn24-Aug-01 21:50
sitebuilderMichael Dunn24-Aug-01 21:50 
GeneralRe: Makeing changes to static text background color and text color?? Pin
Bryan Tyson24-Aug-01 22:13
Bryan Tyson24-Aug-01 22:13 
GeneralRe: Makeing changes to static text background color and text color?? Pin
Michael Dunn24-Aug-01 22:16
sitebuilderMichael Dunn24-Aug-01 22:16 
GeneralComposite Control Pin
KingsGambit24-Aug-01 20:53
KingsGambit24-Aug-01 20:53 
Generalregarding flexgrid and mfc dialog based Pin
Cnoob24-Aug-01 18:23
Cnoob24-Aug-01 18:23 
GeneralSimple Toolbar Question. Pin
Mike Doner24-Aug-01 17:33
Mike Doner24-Aug-01 17:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.