Find the answer to your Linux question:
Results 1 to 3 of 3
Yes, I have the same problem. I tried both gcc and g++ in both c and c++ way. And even in a gdb, it output correctly, but in the terminal, ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    1

    no output in terminal window

    Yes, I have the same problem. I tried both gcc and g++ in both c and c++ way. And even in a gdb, it output correctly, but in the terminal, it don't work!!
    This is the code:

    #include <iostream>

    int main(){
    // (void)printf("Hello world!\n");
    std::cout << "Hello World!" << std::endl;
    return 0;
    }

    This is the output in gdb:
    (gdb) run
    Starting program: /home/jin/Documents/Programming/Database/test
    Hello World!

    This is the terminal:
    jin@Jin-R52:~/Documents/Programming/Database$ test
    jin@Jin-R52:~/Documents/Programming/Database$

    Can anyone help me? Or any suggestion?

    Thanks

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    Do not use the name test for your program.
    There is a test command installed on your system.
    It will run, instead of your program.

  3. #3
    Linux Newbie tetsujin's Avatar
    Join Date
    Oct 2008
    Posts
    115
    Quote Originally Posted by rcgreen View Post
    Do not use the name test for your program.
    There is a test command installed on your system.
    It will run, instead of your program.
    It's OK to use "test" as the name of your program - but the thing is, the current directory usually isn't on the PATH anyway...

    Running "which test" will probably tell you /usr/bin/test
    If you want to run a program called "test" in the current directory, run "./test", not "test".

Posting Permissions

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