Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-2007, 05:08 PM
theillbehaviored theillbehaviored is offline
Newbie
 
Join Date: Mar 2007
Posts: 1
Rep Power: 0
theillbehaviored is on a distinguished road
Default C++ help required

Im making this single player MUD with C++ and I keep getting theese error messages
  1. error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (
  2. or there is no acceptable conversion)
  3. error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (
  4. or there is no acceptable conversion)
  5. error C2447: missing function header (old-style formal list?)
  6. Error executing cl.exe."

Code:
 

#include <iostream>
#include <fstream>
#include <string>
#include <C:\Documents and Settings\Camper #1.IDKPPL\Desktop\MUD\look.h>
#include <C:\Documents and Settings\Camper #1.IDKPPL\Desktop\MUD\info.h>
#include <ctime>
using namespace std;



ifstream a_file ("info.txt");


 
void sleep(unsigned int mseconds)
{
    clock_t goal = mseconds + clock();
    while (goal > clock());
}
int info(int EXP,int HP);
int look(int room);
int main()

{
HP = 100;
EXP = 0;
room = 1;
string name;
string command("look");

cout<<"Whats your name?";
cin>> name;
cout<<"Welcome "<< name <<"\n";

switch (command)
{ case 'look':
look(); break;
case 'info':
info();
break;} 
return 0; }
Can someone please assist me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-02-2007, 11:37 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 1,953
Last Blog:
NaNoWriMo Day 15
Rep Power: 24
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default

That looks like something may be corrupted in your #include files. It's not clear whether the error is in the code you provided or in look.h and info.h,
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-10-2007, 08:19 AM
Code Goddess's Avatar   
Code Goddess Code Goddess is offline
Newbie
 
Join Date: Mar 2007
Age: 29
Posts: 9
Rep Power: 0
Code Goddess is on a distinguished road
Default

Excluding what I don't know about look.h and info.h, there's quite a bit wrong with your code:

>while (goal > clock());
A busy wait loop is extremely antisocial in a multitasking system.

>HP = 100;
>EXP = 0;
>room = 1;
Unless these guys are defined in one of your headers (which is a bad idea in the first place), they're undefined and you can't use variables without defining them.

>switch (command)
You can't do a switch on a string, only integral types.

>case 'look':
>case 'info':
These are character literals, not string literals. It's generally a bad idea to use multi-character character literals because they're implementation-defined unless you use very specific escape sequences.

>binary '>>' : no operator defined which takes a right-hand operand of type <string>
>binary '<<' : no operator defined which takes a right-hand operand of type <string>
These errors mean that operator << and operator >> don't recognize the type that you're using. Usually that means you forgot to qualify for the std namespace. With your code, that's not the case, but not knowing the contents of your headers makes it harder to determine the exact problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 10:19 AM.

Contest Stats

John ........ 203.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 63%

Ads