LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   something wrong with gcc (https://www.linuxquestions.org/questions/linux-newbie-8/something-wrong-with-gcc-57241/)

wapcaplet 04-30-2003 02:11 PM

I just thought of something... someone else just asked a similar question. Did you make sure to print a newline (endl, or "\n") after printing "Hello" from your program? Output doesn't always go to the screen unless you send a newline.

i.e.:

Code:

#include <iostream>
using namespace std;
int main() {
  cout << "Hello" << endl;
  return 0;
}

gcc test.cpp -o test
./test

freemind 04-30-2003 03:49 PM

My source code is:

/*Filename: test.c
make command: gcc -o test test.c
*/

#include <stdio.h>

int main()
{
printf("Hello\n");
return 0;
}


Pretty simple and includes newline. It always works with "./test" but not with "test"

Kevin, I'm not getting any error messages and it just returns to prompt when I run "test".

The whole path is: .:.:.:/bin/:/usr/bin:/usr/bin/X11:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/home/XL/bin:/home/XL/bin

Thank you so much!

shadowbird 04-30-2003 04:42 PM

AhA!!!!!!!!!!!!!


"test" is a unix command. Try calling it something else like "foo" or "blah"

freemind 04-30-2003 08:12 PM

Kevin, you are so right!!!!! Many thanks. ( I should remember I encountered the same problem in UNIX. :p )


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