An issue with code::blocks and c

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
ChrissyJ91
Chaos Rift Regular
Chaos Rift Regular
Posts: 149
Joined: Tue Oct 28, 2008 5:36 pm
Favorite Gaming Platforms: PS1/2
Programming Language of Choice: C/C++
Location: UK

An issue with code::blocks and c

Post by ChrissyJ91 »

Hello, I am trying to teach myself c using the book "Absolute beginners guide to c by Greg Perry" but have run into some problems. The very first program he gives you is a simple printf program which I have displayed here:

Code: Select all

/* Prints a mesage on the screen */
#include <stdio.h>
int main()
{
    printf("this c stuff is easy!");
    return 0;
}


however when I compile this code in code::blocks it runs however the output text (in fact any output text as I have tried changing it) is changed to "hello world"
I'm not sure if anyone has experienced this problem and or knows how this can be resolved? any help would be appreciated.
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: An issue with code::blocks and c

Post by davidthefat »

I think you need to just compile and run it yourself... Seems like its running the precompiled one from the last build
User avatar
ChrissyJ91
Chaos Rift Regular
Chaos Rift Regular
Posts: 149
Joined: Tue Oct 28, 2008 5:36 pm
Favorite Gaming Platforms: PS1/2
Programming Language of Choice: C/C++
Location: UK

Re: An issue with code::blocks and c

Post by ChrissyJ91 »

thank you for the suggestion but it hasn't changed despite compiling and running it again. :(
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: An issue with code::blocks and c

Post by davidthefat »

ChrissyJ91 wrote:thank you for the suggestion but it hasn't changed despite compiling and running it again. :(
Its probably the settings on code::blocks... I dont use Code::blocks so I cant help you, try using devc++ http://www.bloodshed.net/devcpp.html its an all c/c++ ide, so it should fix your problem
User avatar
ChrissyJ91
Chaos Rift Regular
Chaos Rift Regular
Posts: 149
Joined: Tue Oct 28, 2008 5:36 pm
Favorite Gaming Platforms: PS1/2
Programming Language of Choice: C/C++
Location: UK

Re: An issue with code::blocks and c

Post by ChrissyJ91 »

I have dev c++ I stopped using it after I found that the console window only opens for a split second and then closes. I'm sure that there is at least one command I can use to keep it open but I'm not sure what it or they might be.

edit: fixed it using getchar(); so it wil wait for user input before closing. sweet. I think I've found my compiler. thanks for the help davidthefat. :)
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: An issue with code::blocks and c

Post by davidthefat »

ChrissyJ91 wrote:I have dev c++ I stopped using it after I found that the console window only opens for a split second and then closes. I'm sure that there is at least one command I can use to keep it open but I'm not sure what it or they might be.

edit: fixed it using getchar(); so it wil wait for user input before closing. sweet. I think I've found my compiler. thanks for the help davidthefat. :)
No Problem, I been there done that, not Im a noob in the world of GUI :lol:
User avatar
ChrissyJ91
Chaos Rift Regular
Chaos Rift Regular
Posts: 149
Joined: Tue Oct 28, 2008 5:36 pm
Favorite Gaming Platforms: PS1/2
Programming Language of Choice: C/C++
Location: UK

Re: An issue with code::blocks and c

Post by ChrissyJ91 »

:lol: . I'm really amped now I can actually make some progress in a book that I can actually understand although it is half three in the morning... actually... sleep can wait....
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: An issue with code::blocks and c

Post by MarauderIIC »

ChrissyJ91 wrote:Hello, I am trying to teach myself c using the book "Absolute beginners guide to c by Greg Perry" but have run into some problems. The very first program he gives you is a simple printf program which I have displayed here:

Code: Select all

/* Prints a mesage on the screen */
#include <stdio.h>
int main()
{
    printf("this c stuff is easy!");
    return 0;
}


however when I compile this code in code::blocks it runs however the output text (in fact any output text as I have tried changing it) is changed to "hello world"
I'm not sure if anyone has experienced this problem and or knows how this can be resolved? any help would be appreciated.
Looking like you did something like compile the active project which has "hello world" but you didn't add your new file to it, or something.
I heard Dev-C++ isn't supported anymore? Not sure? I likes to recommend sum Microsoft Visual C++ Express.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: An issue with code::blocks and c

Post by RyanPridgeon »

Dev C++ has been abandoned for years.

Code::Blocks is pretty much the newer, better, still in production version of Dev C++. So I recommend you go back to Codeblocks and figure out what you did wrong, because you may be limited in the future if you stick to Dev Cpp :P
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: An issue with code::blocks and c

Post by K-Bal »

RyanPridgeon wrote:Dev C++ has been abandoned for years.

Code::Blocks is pretty much the newer, better, still in production version of Dev C++. So I recommend you go back to Codeblocks and figure out what you did wrong, because you may be limited in the future if you stick to Dev Cpp :P
I might be wrong but I've not heard anything from C::B for years, too.

I would recommend using Qt Creator, which has some great features and is actively developed.
User avatar
JaxDragon
Chaos Rift Junior
Chaos Rift Junior
Posts: 395
Joined: Mon Aug 04, 2008 2:03 pm
Current Project: Kanoba Engine
Favorite Gaming Platforms: PS3, PC
Programming Language of Choice: C++
Location: Northeast NC

Re: An issue with code::blocks and c

Post by JaxDragon »

K-Bal wrote:I might be wrong but I've not heard anything from C::B for years, too.
They actually update it quite often, you just have to get it from their SVN.
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: An issue with code::blocks and c

Post by K-Bal »

Good to know, a new release wouldn't hurt ;)
User avatar
Kros
Chaos Rift Regular
Chaos Rift Regular
Posts: 136
Joined: Tue Feb 24, 2009 4:01 pm
Current Project: N/A
Favorite Gaming Platforms: PC, Playstation/2/3
Programming Language of Choice: C++
Location: Oregon,USA
Contact:

Re: An issue with code::blocks and c

Post by Kros »

MarauderIIC wrote:I likes to recommend sum Microsoft Visual C++ Express.
Just adding a /signed to this ones right aboot here.
Isaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
YouTube Channel
Post Reply