Skip to main content

Getting Started with C or C++

On MAC :

Source : [ http://www.cprogramming.com/xcode.html ]

Using Apple XCode

Once you've downloaded XCode, you can install it from the disk image. Then you can run XCode from Developer|Applications|XCode. XCode has lots of documentation and can walk you through setting up a project.

The very simplest thing to do is to create a new project from "File|New Project...". First choose "Application" and then "Command Line Tool". This will give you a basic command line program that you can use when you're learning to program. Before you leave that screen, make sure to change the "Type" of the project to "C++ stdc++" if you are using C++ instead of C. Go through the rest of the prompts and create your new project. Now you have a small project set up that has a main.cpp file. You can edit main.cpp, but by default it will include a small sample "hello world" program.

Let's go ahead and run that sample program--select "Build and Run" button from on the toolbar. This will compile your program, but I find that it won't actually run it. To do that, you need to double-click the executable file. By default, you should see that the executable file is in the top window, along with main.cpp and a file ending with .1 (a file that's there for creating a man page). When you first start out, the executable will be colored red, but once you build, it will look normal. Go ahead and double-click it and you can see your program execute.

g++

Released by the Free Software Foundation, g++ is a *nix-based C++ compiler usually operated via the command line. It often comes distributed with a *nix installation, so if you are running Unix or a Linux variant you likely have it on your system. You can invoke g++ on a source code file simply by typing:
g++ filename
 
The default executable output of g++ is "a.out". It is also possible to specify a name for the executable file at the command line by using the syntax:
-o outputfile
, as shown in the following example:
g++ filename -o outputfile

Find Out More

If you are using a *nix system, you can also check out the other g++ command line options by typing
man g++

Comments

Popular posts from this blog

How to Use Chisanbop (Korean Finger Math) for Basic Addition and Counting | eHow.com

How to Use Chisanbop (Korean Finger Math) for Basic Addition and Counting eHow.com Difficulty: Easy Instructions Step 1 In Chisanbop you'll be using your two hands and ten fingers to represent numbers from 0 to 99. Start out with your hands out in front of you with closed fists. This represents 0. Each finger (not thumb) on your right hand represents 1. To represent 3, just press down three right hand fingers. Your right thumb represents 5. To represent 7, press down your right thumb and 2 right hand fingers. Think of your right hand as the ones or units place (column). Step 2 Your left hand represents the tens place (column). Each finger on your left hand is worth 10. For example, to represent 30, press down three left hand fingers. To represent 38, do the same, but also use your right hand to represent 8 as described above. Your left thumb represents 50. To represent 86, press down your left thumb and three left hand fingers for the 80, and your right thumb and one righ

How to load the sample database into the MariaDB server.

1. Download  the Sample Database  (Source :  https://www.mariadbtutorial.com/getting-started/mariadb-sample-database/  ) 2. unzip the file to a directory e.g.,  c:\mariadb\nation.sql 2.   connect to the MariaDB server  with the  root  user account, type the password and press the   Enter  keyboard. sudo mysql -u root -p Enter password: ******** 3.  Load the database by using the source command: mysql>source c:\mariadb\nation.sql 4.  select the   nation   database and display tables of the database: mysql> use nation; Database changed mysql> show tables ;