Bloodshed not recognizing "string"!?

This is a discussion on Bloodshed not recognizing "string"!? within the C++ Programming forums, part of the General Programming Boards category; string partnum; Bloodshed is not recognizing that declaration say syntax error before ';' ? What's wrong? This code is supposed ...

  1. #1
    Unregistered
    Guest

    Unhappy Bloodshed not recognizing "string"!?

    string partnum;

    Bloodshed is not recognizing that declaration say syntax error before ';' ? What's wrong? This code is supposed to work? I have included all the libraries it
    needs:

    #include<iomanip.h>
    #include<fstream.h>
    #include<iostream.h>
    #include<string.h>
    #include<stdio.h>
    #include<stdlib.h>

  2. #2
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    maybe you have a constant before the includes without ';' at the end?
    Paro

  3. #3
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    #include <string> // no .h

    std::string partnum;
    // or make the using namespace declaration

    using namespace std;
    string partnum2;
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  4. #4
    Registered User BigSter's Avatar
    Join Date
    Nov 2001
    Posts
    47
    This is what I use with Bloodshed:

    #include <stdlib.h>
    #include <iostream.h>
    #include <string>
    using namespace std;

    int main(){

    string name;
    cout<<"What is your name?"<<endl;
    cin>>name;
    cout<<"Your name is "<<name<<endl;

    }

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    If your compiler supports namespaces then you can forgo the .h extensions and use the newer header files.
    Code:
    #include <cstdlib> 
    #include <iostream> 
    #include <string> 
    using namespace std; 
    
    int main() { 
    
      string name; 
      cout<<"What is your name?"<<endl; 
      cin>>name; 
      cout<<"Your name is "<<name<<endl;
     
      //return something :)
      return EXIT_SUCCESS;
    
    }
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting OpenGL code to work in Bloodshed
    By Welshy in forum Game Programming
    Replies: 5
    Last Post: 05-12-2009, 11:01 AM
  2. Bloodshed Dev Stops Compiling
    By bengreenwood in forum C++ Programming
    Replies: 4
    Last Post: 11-11-2007, 03:25 PM
  3. How to add a file to a project in bloodshed.
    By Smeep in forum C++ Programming
    Replies: 4
    Last Post: 04-22-2005, 10:29 PM
  4. Bloodshed DEV-C++ Question
    By bman1176 in forum Windows Programming
    Replies: 2
    Last Post: 03-07-2005, 03:43 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21