The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Carreer:Networking Programming in Unix (C programming Language) vibhory2j UNIX for Dummies Questions & Answers 5 09-05-2008 08:57 PM
Sed and Awk Tutorial 0ktalmagik HP-UX 0 04-10-2006 11:29 AM
Tutorial forum? deckard Post Here to Contact Site Administrators and Moderators 1 02-26-2005 12:13 AM
Tk tutorial perleo Shell Programming and Scripting 3 11-18-2002 07:02 AM
afterstep tutorial? xyyz UNIX Desktop for Dummies Questions & Answers 2 09-16-2002 07:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-14-2007
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
looking for tutorial about programming cpp with vi

Hello all
is there somewhere in the web site that gives tips and howto's
on compiling cpp code with the help of vi and gcc ?
and gdb for debugging
  #2 (permalink)  
Old 09-16-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
vi is a text editor
gcc is a compiler
gdb is a debugger

You write code with a text editor
You compile code with a compiler
You test and debug code with a debugger

start with putting the following an a file called "hello.cpp"


Code:
#include <stdio.h>
int main(int argc,char **argv) 
{
    printf("Hello World\n");
    return 0;
}

then put the following in a file called "Makefile"


Code:
all: hello

hello.o: hello.c
     $(CXX) $(CXXFLAGS) -g -c hello.c -o $@

hello: hello.o
     $(CXX) $(CXXFLAGS) -g hello.o -o $@

then type "make" to build it
type "./hello" to run it
type "gdb ./hello" to debug it
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0