Author Topic: Help! Same Program wont go away!  (Read 4280 times)

zeus12345678

  • Guest
Help! Same Program wont go away!
« on: September 02, 2008, 06:15:33 am »
Hi, I have just started teaching myself the c++ language because I am going to be taking a class on the subject in college and wanted to get a head start. I have already written, compiled, and executed my first program, which is the famous "Hello World!" program without a problem.

 The real problem begins when I try to write another program. After successfully running the hello world program, I  tried writing other, completely different programs. However,  when I compile and run them, the same Hello World! message pops up on my screen, even though that is not the program's function. Every time I build and run something, the hello world message is always the result!

I have even tried different programs using cout just like the Hello World program, but with different words, only to recieve the same message "Hello World" on my screen. I have even tried completely deleting the hello world project completely from my computer, but the message continues to show itself!

I am using (of course) code::blocks as my IDE, and my operating system is Xubuntu. My process in which I create a program is by clicking FIle - New -
-Project. then I choose console application, choose c++ as the language, and then name the project. After that, I create a new, empty file, name it, and then write the program ( there were many different programs).

please help, I am new to programming, and I am hoping that this issue is just from a simple mistake that I am making, and hopefully it can fixed soon because class is going to be starting soon! thanks for any advice!

Offline DrewBoo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Help! Same Program wont go away!
« Reply #1 on: September 02, 2008, 03:15:02 pm »
That's certainly unusual. 

How are you building your new program?

How are you running it?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Help! Same Program wont go away!
« Reply #2 on: September 02, 2008, 03:52:55 pm »
I am using (of course) code::blocks as my IDE, and my operating system is Xubuntu. My process in which I create a program is by clicking FIle - New -
-Project. then I choose console application, choose c++ as the language, and then name the project. After that, I create a new, empty file, name it, and then write the program ( there were many different programs).

if you want to add new programs to a pre-existing project, then you need to make sure you add the files containing the programs to the project. If each file represents a separate program then you will need to create a new "target" for each one. (goto project -> properties, build target tab -- select new target, give it a name, type of program (console/gui app), and check off the source files that will be built for that target). you can use the combo box on the compiler toolbar to switch between targets.

alternatively, you can create a new project for each program

OR

if you are creating simple one file programs, then you don't need to use projects at all and can simply open the file that you want to compile and press F9 (make sure you don't have any projects open or this won't work)
« Last Edit: September 02, 2008, 03:54:56 pm by dmoore »

zeus12345678

  • Guest
Re: Help! Same Program wont go away!
« Reply #3 on: September 05, 2008, 04:59:54 am »
hi guys, thanks for your help. I found out that I was making a silly mistake, and realised that I wasnt adding .cpp to the end of my files, god im such a noob. well at least i learned my lesson lol thanks for the help guys.