Thread: code help

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    176

    code help

    i am starting to understand this a little, but i tried to do a small thing that made it just say hello on the screen but these warnings come up

    C:\Dev-Cpp\main.cpp
    [Warning] In function `int main()':
    5 C:\Dev-Cpp\main.cpp
    parse error before `)' token
    C:\Dev-Cpp\Makefile.win
    [Build Error] [main.o] Error 1

    and my code is this ( i used windows.h because that seemed to work better than iostream.h when i use iostream.h or iostream i get a warning that says it doesn't exist.)
    #include <windows.h>

    int main()
    {
    ()cout <<"hello";
    return 0;
    }

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    no () before cout

    just

    cout << "Hello";

    also, try this and see if u get iostream problems

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    cout << "Hello" << endl;
    return 0;
    }

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    if i dont use and () before the cout i get an error message that looks like this

    8 C:\Dev-Cpp\Untitled4.cpp
    `cout' undeclared (first use this function)

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    anyone got any ideas?

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    try what RoD posted, if that doesn't work, check your compiler paths.

  6. #6
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    its telling you its undeclared because you need iostream, try my code then let me know what happens.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    i just tried it and it came up with 370 errors and i am not going to cut and paste them all.

  8. #8
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    try

    Code:
    #include <iostream.h>
    
    int main()
    {
    cout << "Hello" << endl;
    return 0;
    }

    I think its your compiler (setup).

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    that seemed to work better i only got these warnings

    22 C:\Dev-Cpp\main.cpp:1
    iostream.h: No such file or directory.
    C:\Dev-Cpp\main.cpp
    [Warning] In function `int main()':
    5 C:\Dev-Cpp\main.cpp
    `cout' undeclared (first use this function)

    (Each undeclared identifier is reported only once for each function
    5 C:\Dev-Cpp\main.cpp
    `endl' undeclared (first use this function)
    C:\Dev-Cpp\Makefile.win
    [Build Error] [main.o] Error 1

    but if i put the () before cout like this

    i only get these errors
    22 C:\Dev-Cpp\main.cpp:1
    iostream.h: No such file or directory.
    C:\Dev-Cpp\main.cpp
    [Warning] In function `int main()':
    5 C:\Dev-Cpp\main.cpp
    parse error before `)' token
    C:\Dev-Cpp\Makefile.win
    [Build Error] [main.o] Error 1

  10. #10
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    something isnt right with your compiler if its not finding iostream, did you follow all of its setup instructions? What version is it?

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    do you know of a good compiler i can download?
    or how to set up dev-c++ version 4.9.7.0?

  12. #12
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Borland has a trial version, bloodshed, djgpp(spelling?) i think.

    As far as setting it up, check google or the boards. Compilers and such has been covered many many times.

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    176
    i have bloodshed and djpp i think you have to download a bunch of things rather than just one big download and there are so many things there that it gets confusing if anyone has the downloads i need send them to me my e-mail is [email protected]

  14. #14
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I'm attaching a zip with two iostream files in it, but i only ever used VC++ so i cant be sure it will work, but i doubt it.

  15. #15
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    try setting your compiler settings to these:

    settings

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM