Author Topic: simple c++ project  (Read 13497 times)

anupgupta

  • Guest
simple c++ project
« on: May 16, 2010, 05:12:57 pm »
Hello

I am using Ubuntu 10.04, and installed code::blocks in it...what i am looking is how do i set it up for a simple hello world program in c++ using gcc compiler..
any suggestions most welcome...

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: simple c++ project
« Reply #1 on: May 16, 2010, 05:26:19 pm »
"File -> New -> Project ..."

http://www.codeblocks.org/user-manual

Offline DonSlowik

  • Single posting newcomer
  • *
  • Posts: 3
Re: simple c++ project
« Reply #2 on: June 01, 2010, 10:56:08 pm »
Wondering if there is a step-by-step guide for editing, compiling, debugging a simple HelloWorld.cc program out there. Assuming we have Code::Blocks is set up all ready, just the steps to get us up and going..
Thanks,
Don

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: simple c++ project
« Reply #3 on: June 01, 2010, 11:10:38 pm »
1. "File -> New -> Project ..."
2. Choose console application
3. Press GO
4. Follow the steps
5. Press the gear button to build the project
6. Press the green play like button to run the project (gear + play == build & run)
7. Press the red play like button to debug the project

(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 gentoo

  • Single posting newcomer
  • *
  • Posts: 2
Re: simple c++ project
« Reply #4 on: June 02, 2010, 07:22:36 am »
Hello

I am using Ubuntu 10.04, and installed code::blocks in it...what i am looking is how do i set it up for a simple hello world program in c++ using gcc compiler..
any suggestions most welcome...
I am using same OS and got it working all i did when i got codeblocks program up under tab "start here" in the project area i scrolled down to start a new project clicked on that and a window opened i used console application to make a simple program once i double-clicked that another window opens select next then c++ then next and this is tricky part i had to go into terminal outside of codeblocks to mkdir test went back to codeblocks program to name project test then clicked next then last window came up click finish i ended up back at codeblocks program in management on the left hand side under workspace you see a kinda of like tree with your project name under workspace drop down to sources and under sources a main.cpp shows up double click that and program should show mine was already made by the way after experimenting a couple of days i find it seems when you program need to use "using namespace std;" as a global before the int main() or to declare it in the program like so "std::cout << "Hello World!\n"; i still can't see why i needed to use <iostream> like so when i tried it like this #include <iostream.h> it couldn't find the header and therefore gave me compilation errors in my functions but i can add something like #include <stdlib.h> just not with <iostream> im not sure this will help because everyone thinks and does things differently that's the part of programming that makes it unique i need a manual bad i don't know the headers or functions() under those headers if anyone can suggest a book or something please let me know:)
« Last Edit: June 02, 2010, 07:40:18 am by gentoo »

Offline gentoo

  • Single posting newcomer
  • *
  • Posts: 2
Re: simple c++ project
« Reply #5 on: June 02, 2010, 08:04:17 am »
Wondering if there is a step-by-step guide for editing, compiling, debugging a simple HelloWorld.cc program out there. Assuming we have Code::Blocks is set up all ready, just the steps to get us up and going..
Thanks,
Don
i agree wouldn't that be wonderful if you know of a book or anything that tells me headers and functions() please let me know i'll buy it i couldn't find anything about those in the user manual so im guessing and personal knowledge which isn't much i had to make a directory in a terminal because when i made a program it didn't know where to save my program to and that program name had to be the same name as my directory but overall this is one of best compiliers i've seen on linux

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: simple c++ project
« Reply #6 on: June 02, 2010, 09:43:23 am »
You are leaving the scope of the C::B forum.

This is not a general programming forum.

C::B is "just" an IDE, that works with many compilers.
The layout of your project and other questions not related to C::B are not allowed here.

This topic might get locked !!

Offline DonSlowik

  • Single posting newcomer
  • *
  • Posts: 3
Re: simple c++ project
« Reply #7 on: June 02, 2010, 03:02:33 pm »
Thanks OfusCated. That got me going. And yes, I think I also had to add a project directory, though I think I did that from within the IDE.
 
As far as guidance on C/C++ libraries, I use the man pages on my Linux, but you can also look at cplusplus.com or google c++ reference.