Code::Blocks Forums

User forums => Help => Topic started by: bradpetrelli on November 24, 2010, 09:50:42 pm

Title: very beginning problem... / please help :(
Post by: bradpetrelli on November 24, 2010, 09:50:42 pm
Welcome all,

I'll start with information that I'm absolutely new with programming in C++. But I want to start with CodeBlocks and i have problem on very beginning because i try to "copy - paste" first program doing everything step by step with manual for dummies... :)...

#include <cstdio>
int main()
{
    printf( "Test Code::Blocks" );
    return 0;
}

this can't be wrong :), but when I'm trying to press Ctrl+F9 or button "Build and run" I'have no respond...
I know that this can mean everything but maybe someone had similar problem...

I have last version of CodeBlocks and Windows7 ...
Please for help and big thanks for all answers.
 
Title: Re: very beginning problem... / please help :(
Post by: mirai on November 24, 2010, 10:17:57 pm
What kind of response do you expect from the system running this program?

Well, actually it's quite simple. Your program just runs and exists without any errors.
If you expect to see a console window with output of your "hello world", insert following line
Code
#include <cstdio>
at the beginning of your program and
Code
getchar();
just before "return 0"
to force your program to wait until you press a key after it finishes its work.

Also, it has no connection to Code::Blocks at all.
Title: Re: very beginning problem... / please help :(
Post by: bradpetrelli on November 24, 2010, 10:27:55 pm
How I have:


#include <cstdio>
int main ()
{
printf( "test" );
getchar();
return 0;
}


and still no respond from CB... also nothing in Build log... i don't have any window, any exe file any respond...   
Title: Re: very beginning problem... / please help :(
Post by: Jenna on November 24, 2010, 10:34:33 pm
Are you sure you have a compiler installed and set it up correctly ?
Title: Re: very beginning problem... / please help :(
Post by: bradpetrelli on November 24, 2010, 11:03:18 pm
can you give me some solution how I can check it ? :) I'm total n00b ... sorry... everyone was on beginning once :)...
Title: Re: very beginning problem... / please help :(
Post by: oBFusCATed on November 25, 2010, 12:39:00 am
Read the manual, read the FAQ in the wiki, read the forum rules and search a bit in the forum...

Being a nOOb is not an excuse for being lazy...
Title: Re: very beginning problem... / please help :(
Post by: Joe on December 02, 2010, 01:10:19 am
Hi bradpetrelli,

I was able to get this code to compile, link and run by adding the 'using namespace std;' statement to the code. Below is the code sample with the added statement at line 2.

1.    #include <cstdio>
2.    using namespace std;
3.
4.    int main()
5.    {
6.        printf ( "Test Code::Blocks" );
7.        return 0;
8.    }

If this information did not help you, or if I am misunderstanding your question, please make another post. I will check back.