Author Topic: Only runs "Hello World" default program  (Read 12912 times)

Offline Dwight939

  • Single posting newcomer
  • *
  • Posts: 3
Only runs "Hello World" default program
« on: May 04, 2012, 01:43:34 am »
Even after I erase all the code on-screen and start building a program and try to run it, it always runs the basic "Hello World" program. What am I doing wrong? I'm a beginner and am trying to follow a tutorial on learning C++ but I can't progress while Code::Blocks doesn't work for me. Help please!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Only runs "Hello World" default program
« Reply #1 on: May 04, 2012, 01:56:10 am »
Tell us what is the steps you do? We need more detailed information.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Dwight939

  • Single posting newcomer
  • *
  • Posts: 3
Re: Only runs "Hello World" default program
« Reply #2 on: May 04, 2012, 01:58:57 am »
I open Code::Blocks, start a new console application, and then erase the parts of the code that make it type "Hello World," then I copy code from the tutorial exactly as it is on the video, but when I run it it still types "Hello World" as if I've done nothing to it at all.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: Only runs "Hello World" default program
« Reply #3 on: May 04, 2012, 02:14:29 am »
Try compiling the new code.
Note: You may have to save it first.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Only runs "Hello World" default program
« Reply #4 on: May 04, 2012, 02:14:42 am »
but when I run it it still types "Hello World" as if I've done nothing to it at all.
OK, so does the tutorial forget to tell you that you need to build the application before run it?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Dwight939

  • Single posting newcomer
  • *
  • Posts: 3
Re: Only runs "Hello World" default program
« Reply #5 on: May 04, 2012, 02:54:15 am »
I do that, I save it, and then press "build and run." I've also tried building then running seperately. I get the same result.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Only runs "Hello World" default program
« Reply #6 on: May 04, 2012, 03:47:10 am »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: Only runs "Hello World" default program
« Reply #7 on: May 04, 2012, 02:47:36 pm »
I do that, I save it, and then press "build and run." I've also tried building then running seperately. I get the same result.

Try using rebuild; the run erases the build log.
Which likely is full of errors.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org