problem with code::blocks compiler

This is a discussion on problem with code::blocks compiler within the C++ Programming forums, part of the General Programming Boards category; hi i am very new to programming and downloaded the code::blocks compiler with the mingw attached and followed the instructions ...

  1. #1
    Registered User iceddragon117's Avatar
    Join Date
    Apr 2012
    Posts
    5

    problem with code::blocks compiler

    hi
    i am very new to programming and downloaded the code::blocks compiler with the mingw attached and followed the instructions on this cprogramming.com.i thought id start by simply doing the "hello world"program in the tutorial but i am getting errors both copy/pasting and typing it manually.

    also i am having problem setting up a console application

    thanks for any help you can offer

  2. #2
    Registered User
    Join Date
    Apr 2012
    Posts
    14
    seriously, if you are on windows use MSVC !, and btw could you please expail more about your errore!

  3. #3
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by iceddragon117 View Post
    hi
    i am very new to programming and downloaded the code::blocks compiler with the mingw attached and followed the instructions on this cprogramming.com.i thought id start by simply doing the "hello world"program in the tutorial but i am getting errors both copy/pasting and typing it manually.

    also i am having problem setting up a console application

    thanks for any help you can offer
    Can you specify what exactly the errors were ?
    Post a screenshot if you can't describe it.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    Straight after making a new project, build and run it. It should do nothing, but will at least compile.
    Then if you start adding bits, make sure it compiles after each part you add.
    When you cant get it to compile, post the entire error messages here.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  5. #5
    Registered User iceddragon117's Avatar
    Join Date
    Apr 2012
    Posts
    5
    i tried to download MSVC but unfortunately the link did not work.
    i did not mean to be so vague here is a list of bugs


    http://cboard.cprogramming.com/image...BJRU5ErkJggg==

  6. #6
    Registered User iceddragon117's Avatar
    Join Date
    Apr 2012
    Posts
    5
    here is a list of the errors
    sorry the screenshot didnt work
    1|error: iostream: No such file or directory|
    3|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
    |In function 'main':|
    7|error: 'cout' undeclared (first use in this function)|
    7|error: (Each undeclared identifier is reported only once|
    7|error: for each function it appears in.)|
    8|error: 'cin' undeclared (first use in this function)|

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    2,577
    Quote Originally Posted by iceddragon117 View Post
    here is a list of the errors
    sorry the screenshot didnt work
    1|error: iostream: No such file or directory|
    3|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
    |In function 'main':|
    7|error: 'cout' undeclared (first use in this function)|
    7|error: (Each undeclared identifier is reported only once|
    7|error: for each function it appears in.)|
    8|error: 'cin' undeclared (first use in this function)|
    Likely you are compiling a file with the ".c" file extension instead of ".cpp" file extension as needed for C++ files.

    For more info see: FAQ-Compiling (errors) - CodeBlocks

    Tim S.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  8. #8
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    You are trying to compile C++ code as C.
    Change the file extension to .cpp if you have it as a .c file now.

    [...I wonder how many seconds my post was late ! ... ]
    Last edited by manasij7479; 04-22-2012 at 07:48 PM.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  9. #9
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    Clearly you didn't follow my advice, or you would have not had that many errors.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  10. #10
    Registered User
    Join Date
    May 2009
    Posts
    2,577
    Quote Originally Posted by iMalc View Post
    Clearly you didn't follow my advice, or you would have not had that many errors.
    The code template for C++ Hello world gives the errors he had if it is compiled as a "C" program.

    Tim S.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  11. #11
    Registered User iceddragon117's Avatar
    Join Date
    Apr 2012
    Posts
    5
    i have not had a chance to try it out yet but i was really trying to avoid such rookie mistakes.
    thanks for the help everybody and if it still wont work ill post later.

  12. #12
    Registered User iceddragon117's Avatar
    Join Date
    Apr 2012
    Posts
    5
    you guys were 100% correct!
    i actually didnt add any extension to the file,so i added .cpp to the end of it and TA-DA it worked beautifully.
    thanks again.now i can really get started.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code:blocks can't find a compiler
    By vrkiller in forum C++ Programming
    Replies: 8
    Last Post: 01-06-2011, 10:08 AM
  2. Output from Code::Blocks Compiler
    By zilefac in forum C++ Programming
    Replies: 4
    Last Post: 08-21-2010, 01:19 PM
  3. Replies: 1
    Last Post: 01-11-2008, 08:34 AM
  4. Code::Blocks problem
    By eaane74 in forum C++ Programming
    Replies: 6
    Last Post: 05-24-2007, 07:24 PM

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