LinuxQuestions.org
Register a domain and help support LQ
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 04-15-2004, 05:29 PM   #1
MaddDog696
LQ Newbie
 
Registered: Apr 2004
Location: NV
Distribution: RedHat 9
Posts: 8

Rep: Reputation: 0
Unhappy G++ compiles fine but program does not work


ok, here is the question; I am pretty familiar with C++ and have been programmig with it in windows for while awhile using DJGPP and dev-C++. I also have been using linux (redhat 9) for awhile as well, and decided to try programming in it. I busted out gedit and wrote this basic code:

Code:

#include <iostream>
using namespace std;

int main()
{
short int x;
cout << "enter a num: ";
cin >> x;
cout << "\nYou entered " << x;
return 0;
}

END


I compiled it using G++ like this

#G++ -o test ./entrnum.cpp

It compiles it and saves it to program 'test', as i told it to. however when i run the program like so:

#test

nothing happens. it just goes to the input command line again as it i never did anything. I would expect that the program listed above, when run through the command line, shoule execute through the terminal and, as in the program, start off with, "enter a num; ". why is nothing happening when i run my program? did i do something wrong in the code, or execute it wrong. i am at a loss of where to go from here. if there is no error report i cannot see what is wrong. i dont think that the code is wrong but please help. it is kind of frustrating. thanx

-MaddDog

Last edited by MaddDog696; 04-15-2004 at 05:30 PM.
 
Old 04-15-2004, 05:32 PM   #2
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Rep: Reputation: 15
try
./test
 
Old 04-15-2004, 05:35 PM   #3
MaddDog696
LQ Newbie
 
Registered: Apr 2004
Location: NV
Distribution: RedHat 9
Posts: 8

Original Poster
Rep: Reputation: 0
Wow, that was easy, thanx so much. I feel slow, lol

-MaddDog

--Linux questions rox
 
Old 04-15-2004, 05:39 PM   #4
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Rep: Reputation: 15
By the way, test is a linux shell command. Try to name your exe file another name
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
icculus.org Duke Nukem 3d: compiles fine but won't run mr.gizm0 Linux - Games 1 04-23-2005 04:03 AM
some applications died when I use ssh when others work fine calix Linux - Networking 1 01-20-2005 05:43 PM
Java, code compiles and supposedly runs fine in windows, but not linux exodist Programming 4 03-16-2004 12:47 PM
compiles fine but a make error bosewicht Linux - Newbie 3 01-04-2004 06:02 PM
CD writing errors... it used to work fine. ngomong Linux - Hardware 5 06-15-2002 03:39 PM


All times are GMT -5. The time now is 06:49 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration