Author Topic: very beginning problem... / please help :(  (Read 3494 times)

Offline bradpetrelli

  • Single posting newcomer
  • *
  • Posts: 3
very beginning problem... / please help :(
« 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.
 

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: very beginning problem... / please help :(
« Reply #1 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.
« Last Edit: November 24, 2010, 10:19:28 pm by mirai »

Offline bradpetrelli

  • Single posting newcomer
  • *
  • Posts: 3
Re: very beginning problem... / please help :(
« Reply #2 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...   

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: very beginning problem... / please help :(
« Reply #3 on: November 24, 2010, 10:34:33 pm »
Are you sure you have a compiler installed and set it up correctly ?

Offline bradpetrelli

  • Single posting newcomer
  • *
  • Posts: 3
Re: very beginning problem... / please help :(
« Reply #4 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 :)...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: very beginning problem... / please help :(
« Reply #5 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...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Joe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: very beginning problem... / please help :(
« Reply #6 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.
Joe Long
WinXP Home/SP3
Code::Blocks/10.05
Borland 5.5/SP2
C++ Student