LinuxAnswers DiscussionThis forum is to discuss articles posted to LinuxAnswers.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hay am very new to this Forums. Yes! am very much looking forword to this kind of discussions. Thanks a lot! its very usefull information.
Thanks once again.
I can only get the second example to work by adding 'using namespace std;' to the code after the two includes. Is this something I have done wrong or an error in the code?
Quote:
#include <iostream>
#include <string>
using namespace std;
int main()
Thanks for posting this info. I've done a fair bit of C++ programming, but I'm new to Linux, and was growing tired of sifting thru the Masters level work on g++ (I just wanted to know how to compile!!!). Thanks so much!!!
The example was obviously simple, but the syntax was very useful!
hi,
i am really new to Linux. im using Ubuntu Ultimate 8.10.
i wish to continue using linux instead of windows. i found substitute for almost everything. the normal way of compiling in linux as described in your post is hard for me. i installed 'Geany', it sure does looks good. can you help me in how to use it?. it sure is not the way we use turbo c++ compiler 4.5 rt?. so please help me out
thanks in advance.
Yes you do, otherwise the code will fail to compile.
I also thought that using vi(m) in a basic introduction to c++ was an unnecessary complication.
The code could be written in any text editor and vi is not noob friendly.
I always use vi to edit text file in UNIX/Linux but there was not enough space allocated to give a mini "how to" on vi, plus what is the point when there are so many text editors to choose from.
kate or gedit would have been better choices for demonstration purposes, and wouldn't have taken emphasis away from the topic being explained.
Last edited by Disillusionist; 12-13-2008 at 12:04 PM.
There is a easy method to bulid "C" & "C ++ " programming:
There are three methods to bulid "C" & "C++" programming in RHL 9.0 & FC .by using GNOME desktop & another in KDE .
There are mainly two editor in GNOME , viz. vi- editor & another is emacs editor.I will discuss both here.
using VI-editor:
1. open terminal .
2. type for C programming
vi <filename>.c
for C++
vi <filename>.cpp
e.g:
vi hello.c { for C}
vi hello. cpp { for C++}
3. then type " i" ( i= insert)
4. then write source code . for details www.howstuffworks.com how to works "C" programming?
5. then press
esc : wq
it is save now.
6. now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )
8. then it will see your screen.
USING EMACS EDITOR:
1.type emacs<file name> on terminal.
3. then type " i" ( i= insert)
4. then write source code . for details www.howstuffworks.com how to works "C" programming?
5. then press
esc : wq
it is save now.
6. now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )
8. then it will see your screen.
USING KWRITE IN ( GNOME OR KDE DESKTOP)
1. Open terminal & type kwrite
2. then write source code
3. then click file .
4. then clck save as
5. save the file wtth extension .c/.cpp
now for comile the programme type,
cc <filename>
7. then for execute type
(dot)/a.out ( dot = . )
Use gvim (vim with the GUI) it puts the edit into it's own window and once does not have to exit and reenter as compiles fail (due to typos etc). The best IDE is not not "Intergraded" as the best allows one to use the tools that they think are best. I like to use ddd as the debugger, gvim as the editor, a an xterm as my terminal. Since I never have been a "Microsoft Windows" user, I actually have all of this open and overlapping on the same desktop. I also make use of the (old default which is not longer the defaul) of "focus follows mouse" and "auto raise" so moving the mouse from on window to the other is all that is needed to use the other window. This allows (better tools) to be used for each part of development rather than the average tools that are in an IDE. (Some distros include the gvim product, some have to add it as it is not preselected and some do not include it at all. (Some call it gvim and others might call it vim -X11.)
Thanks for the tut partha! Exactly what I was looking for. Vi imo is the editor of choice! I know its a little dated, but still very relevant.
Can a mod or someone edit the post to make sure using namespace std; is included? would be nice, though not necessary I suppose.
And do not let Disillusionist fool you! I'm a complete programming noob, but Vi is my swiss army knife! Every noob should learn how to use it--its akin to the sword that grants user more exp and strength by use .
Last edited by slugman; 06-27-2010 at 12:46 PM.
Reason: i can't spell
And do not let Disillusionist fool you! I'm a complete programming noob, but Vi is my swiss army knife! Every noob should learn how to use it--its akin to the sword that grants user more exp and strength by use .
As I stated, I always use vi for text editing in UNIX/Linux. My point was:
Quote:
there was not enough space allocated to give a mini "how to" on vi
As far as writing code goes, the demonstration did not need to state one text editor over another, and vi is not intuitive but rather something that you learn.
I agree that every one should learn how to use vi, but one of the great things about Linux and the Open Source community is the freedom of choice.
You state that you are "a complete programming noob" but that doesn't mean that you are new to Linux. Try to remember when you were first introduced to vi (for me that was about 12 years ago)
can you tell me where can i find socket programing in C++ tutorials, i am just a beginner.
C will do also but if it is explained very well as i already mentioned i am just a beginner of socket programing.
how do you exit out of the edit file? I write the source and then i save it, but how do i exit back into the user shell?
--noob tryin to rtfm--
cryptowicked-
press ESC
then ":wq" (without the quotes, to save and exit)
I would signest to learn how to use vi before learning C++
Save the following file as "vimtutor" and edit it with vi, this will learn you how to use the basic functions of vi http://www2.geog.ucl.ac.uk/~mdisney/.../unix/vimtutor
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.