Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
right, im gonna learn c or c++ in a linux environment 3 questions.. 1) what editors do i use? 2) how do i compile my code? 3) is there n ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2003
    Location
    /bin/bash
    Posts
    27

    C compiler, editor


    right, im gonna learn c or c++ in a linux environment

    3 questions..
    1) what editors do i use?
    2) how do i compile my code?
    3) is there n good basic starting tips/tuts/refrences to learn from??

    thnx in advanced

  2. #2
    Linux User
    Join Date
    Jun 2003
    Location
    Calgary, AB CANADA
    Posts
    496
    If you've got a few hours to kill, I'd recommend the link below as a decent starting point for C++. Quite good as a theoretical intro to the language.

    http://www.cplusplus.com/doc/tutorial/index.html
    \"Everything should be made as simple as possible, but not simpler.\"
    Albert Einstein

  3. #3
    Linux Engineer big_k105's Avatar
    Join Date
    May 2003
    Location
    Fargo, ND
    Posts
    901
    for the how to compile question you should go into your console on your linux box and time in
    Code:
    man gcc
    there is like over 7000 lines of info on how to use it. and if you didnt know gcc is a C/C++ compiler.

    and for editting i beleive any text editor would be fine. jst remeber to save the file with the right extention
    BIG K aka Kyle
    Programming Forums
    www.kylekonline.com
    Please don\'t PM me for help-- ask in the forums instead!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    use any standard text editor you like. give your C files a .c extension, C++ files should have .cpp extension.

    To compile basic programs:
    "gcc <SOURCEFILE> -Wall -o <EXECUTABLE FILENAME>"

    Jason

  6. #5
    Just Joined!
    Join Date
    Jul 2003
    Location
    /bin/bash
    Posts
    27
    Thanx for da help guys.

    n sorry if they were really bumbum questions, but im new to linux as well as the C language, so i didnt know nething.

  7. #6
    Just Joined!
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    52
    I'll go along with the above ofcourse.
    The degree of choice is a lot...

    You may also like to look at www.fltk.org, they have an excellent light weight designer, as smooth as Borlands CBuilder range, but a designer only. The program itself exists as a set of projects that you can bring up in the designer to configure to tast...
    And ofcourse it's a free. It uses generic c/c++ coding styles as well, which i like, ie; a main() function, rather than trying to wrap everything up in a ide specific way [ no offence gtk ], the only wrapping it does is
    to the Xaw libs (X's widget lib).
    [ Sounds like a plug to me too ]

    I like emacs as an editor, but again thats also a subjective choice on my part. Emacs has various modes that may be applied, and you can compile in the
    editor, so anything along those lines,ie vim...

    help info -- I always end up bringing up 'xman' to view manual pages, there very usefull. It took ages to configure #$%@!$&* xman as well i might say

    Try compiling some pre arranged tar ball packages and redirect the sto to a log, ie; gcc <paras> 2>&1 |tee logfile
    That way you can get an idea of the kind of switches people think are important, and how there used. www.gnu.org is also a good stop off point too.

    If you don't mind going a little crazy,
    then programing can be a lot of fun...

    jm

  8. #7
    Just Joined!
    Join Date
    Jul 2003
    Location
    NZ
    Posts
    17

    conio.h in linux

    Hi There!

    I'm trying to learn C in linux with a book written for dos users.

    I came across a program with the following lines:

    #include <conio.h>

    and then

    getch();

    But gcc dosn't know what conio.h is, and the getch(); thing comes under it. Heard somewhere that conio.h is for dos/win systems, so what do I use in linux for getch(); or equivelent?

    Cheers
    Forrest.

  9. #8
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    conio.h is part of C++, not standard C. AFAIK getch() is not 100% standard, but i may be wrong. Read's a single charater from stdin?

    have a look at "getchar()" (command line, run "man getchar"), which requires <stdio.h> (standard input/output header file).

    Jason

  10. #9
    Just Joined!
    Join Date
    Jul 2003
    Location
    NZ
    Posts
    17
    Well the book was a C book (NOT c++)!!

  11. #10
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    Quote Originally Posted by forrest44
    Well the book was a C book (NOT c++)!!
    I read about it in a Windows C++ book, and have NEVER ever seen it in a straight C book, therefore assumed that it was C++ specific.

    Hope i answered the original question anyway.

    Jason

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •