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 |
try
./test |
Wow, that was easy, thanx so much. I feel slow, lol
-MaddDog --Linux questions rox |
By the way, test is a linux shell command. Try to name your exe file another name
|
All times are GMT -5. The time now is 12:05 PM. |