Thread: Simple C++ question

  1. #16
    Registered User
    Join Date
    Aug 2003
    Posts
    42
    Visual C++ 6 isn't good enough, what about Dev C++ 4? Yep, even Borland gives me the same error.
    Sigh, nothing ever works the first try.

    Register Linux User #314127

  2. #17
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    So this doesnt compile?:
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    cout<<"Hello world!";
    
    }
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #18
    Registered User
    Join Date
    Aug 2003
    Posts
    42
    Yes, it does.

    But whenever I use it in larger programs (more than one include), it throws errors at me..like this:

    Code:
    #include <stdlib>
    #include <fstream>
    #include <string>
    
    using namespace std;
    Will not compile. Error message: "Could not find include file "stdlib". (That is only part of a program, I know that there is no main() listed here...hehe)
    Sigh, nothing ever works the first try.

    Register Linux User #314127

  4. #19
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Because the C header files are prefixed with c.

    E.g. it should be #include <cstdlib>

    The C++ standard headers are:

    <algorithm> <bitset> <cassert>
    <cctype> <cerrno> <cfloat>
    <ciso646> <climits> <clocale>
    <cmath> <complex> <csetjmp>
    <csignal> <cstdarg> <cstddef>
    <cstdio> <cstdlib> <cstring>
    <ctime> <cwchar> <cwctype>
    <deque> <exception> <fstream>
    <functional> <iomanip> <ios>
    <iosfwd> <iostream> <istream>
    <iterator> <limits> <list>
    <locale> <map> <memory>
    <new> <numeric> <ostream>
    <queue> <set> <sstream>
    <stack> <stdexcept> <streambuf>
    <string> <strstream> <utility>
    <valarray> <vector>
    Last edited by Cat; 10-05-2003 at 09:30 PM.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  5. #20
    Registered User
    Join Date
    Aug 2003
    Posts
    42
    Wow, I never knew that.

    Thanks Cat. Well it looks like this now

    Code:
    #include <cstdlib>
    #include <fstream>
    #include <cstring>
    
    using namespace std;
    But it's acting like fstream doesn't exist.

    Sigh, nothing ever works the first try.

    Register Linux User #314127

  6. #21
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Start a new post then about your specific problem; it's almost certainly an error in your code -- the stream classes changed somewhat from their original pre-1998 incarnations, so maybe you use it in an strange way that is no longer supported. I'd have to see more than the includes to tell what is wrong.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 08:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 06:58 PM