LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2001, 02:14 PM   #1
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Rep: Reputation: 30
Programming newbie


Is it possible to program through the terminal or console rather than using a text editor..If so....how can I do this? Ohhhh I am using Mandrake 8....Thanx
 
Old 07-21-2001, 02:25 PM   #2
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
You mean at the console? How 'bout 'vi' or 'emacs' or 'joe' or 'elvis'...?

I guess if you wanted it to be really difficult you could just use
Code:
echo "static void Oh_My_Gawd_this_will_be_fun ( struct yikes )" >> krazykernel.c
 
Old 07-21-2001, 05:12 PM   #3
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Original Poster
Rep: Reputation: 30
Yeah....thats what i want through the console....So how I get int Emacs or vi??
 
Old 07-21-2001, 05:59 PM   #4
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
Code:
vi
It's a bit of a learning curve, but it's also an addiction.
I believe emacs has better formatting tools for programmers, but I'm sure someone here can offer a better suggestion or elaborate on the above.
 
Old 07-21-2001, 06:58 PM   #5
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Original Poster
Rep: Reputation: 30
So we can do C++ programming in emacs? It will take some gettin' use...got any tips?
 
Old 07-21-2001, 07:42 PM   #6
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Original Poster
Rep: Reputation: 30
Hey....I need some help with this emacs stuff......I do the compile and I get make: *** No targets specified and no makefile found.
I am doing the hello.cxx program..do I have to specify the directory. I thought it would do the default dir.
 
Old 07-21-2001, 08:25 PM   #7
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
It's been a long time since I used emace, but I'm guessing that the compile option in emacs is just calling make in a shell. make needs a file called Makefile in order to compile your program. You have two options. One, create a makefile with the rules to build your hello.cpp file. Two, (recommended) in a second window type g++ -o hello hello.cpp.

It's not really worth writing a Makefile for something as small as hello.cpp, but if you do intend to rebuild a file over and over for testing it may be beneficial. For my small test programs I have kind of a "general purpose" makefile that I can add most any simple program to.

Writing Makefiles can drive you crazy if you do not follow the make rules exactly. (watch your tabs instead of spaces).
 
Old 07-21-2001, 09:33 PM   #8
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Original Poster
Rep: Reputation: 30
Thanks for the info...crabboy, Would that second window to open be in the emacs console or a terminal?
 
Old 07-21-2001, 09:47 PM   #9
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Original Poster
Rep: Reputation: 30
Alright......finally progress!!!! I got it to compile to an executable file thanks to crabboy...Now how do i run the executable?<-----I promise this the last question on this...
 
Old 07-22-2001, 09:48 AM   #10
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Change the permissions on the hello to allow execution. Try: chmod 755 hello. This will turn on execution for every user that may try to execute it. Then type ./hello and the program should execute.

Note: if you want to execute something without adding execute permissions you can always do it like this: . ./hello

Good Luck

Gary
 
Old 07-22-2001, 02:13 PM   #11
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
Quote:
Originally posted by crabboy


Note: if you want to execute something without adding execute permissions you can always do it like this: . ./hello

actually, this is a common misconception. i thought this until jharris pointed it out to me a few days ago. the execute permissions HAVE to be set, otherwise you get a "permission denied" error. for demo, try this out on a text file
 
Old 07-23-2001, 09:03 PM   #12
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
This was a text file and it was executed by the shell.

Code:
-rw-r--r--   1 webtest   users         715 Jul 23 21:59 todo

bash$  . ./todo

bash: System:: command not found
bash: ./todo: line 2: unexpected EOF while looking for matching `''
bash: ./todo: line 14: syntax error: unexpected end of file
 
Old 07-24-2001, 01:30 AM   #13
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
ok great that's two straight i've gotten wrong here.

in my defense, i didn't notice that there were two .'s i always used to execute stuff with just the ./ - which i thought would treat any file as executable, until jharris corrected me on that. well... learn something new, i guess.

next time i'm just gonna step out of the way of anyone who has more posts than me
 
Old 07-25-2001, 03:30 AM   #14
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
isajera: Actually I kind of got sucked into that one, too. The ". ./" is a new one to me. Should I just forfeit a couple hundred 'posts' now?

I gotta go play with some dots and slashes...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Questions for Newbie.. gentlethunder Linux - Newbie 2 08-04-2005 06:32 PM
c newbie programming kpachopoulos Programming 1 03-24-2005 04:46 PM
newbie: Linux programming for C++ chanwing Programming 8 02-06-2005 08:26 PM
Programming Newbie tipaul Slackware 3 08-05-2003 05:37 PM
Newbie question> Programming with C Juan Araya Slackware 2 03-06-2003 08:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration