I just started using VC10 and I am getting the following error, could anybody try to pop in with a fix?
1> consoleC++Test.cpp
1>c:\projects\programming\windows\c++\code\gameclub\consoleaplic\consolec++test\consolec++test\consolec++test.cpp(9): error C3867: 'std::basic_string<_Elem,_Traits,_Ax>::size': function call missing argument list; use '&std::basic_string<_Elem,_Traits,_Ax>::size' to create a pointer to member
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>c:\projects\programming\windows\c++\code\gameclub\consoleaplic\consolec++test\consolec++test\consolec++test.cpp(9): error C2446: '<=' : no conversion from 'unsigned int (__thiscall std::basic_string<_Elem,_Traits,_Ax>::* )(void) const' to 'int'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> There is no context in which this conversion is possible
1>c:\projects\programming\windows\c++\code\gameclub\consoleaplic\consolec++test\consolec++test\consolec++test.cpp(9): error C2297: '<=' : illegal, right operand has type 'unsigned int (__thiscall std::basic_string<_Elem,_Traits,_Ax>::* )(void) const'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
This is the code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include "stdafx.h"
#include <iostream>
#include <cstdio>
#include "windows.h"
void timerFunction ( std::string a)
{
int i;
for (i = 0 ; i <= a.size ; i++)
{
std::cout << a[i];
Sleep(1000);
}
}
void main()
{
int iTest;
std::string sTest = "Hello world!";
timerFunction(sTest);
std::cin >> iTest;
}
|