Works in windows but not in debian

This is a discussion on Works in windows but not in debian within the Linux Programming forums, part of the Platform Specific Boards category; Hello everyone. I was wondering if anyone has ever came across this issue. Code: #include <stdio.h> main(){ printf("Testing"); } When ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Question Works in windows but not in debian

    Hello everyone. I was wondering if anyone has ever came across this issue.
    Code:
    #include <stdio.h>
    
    main(){
    printf("Testing");
    }
    When running this code in windows everything works great. When doing so in Linux it runs but doesn't output anything to the screen. I've been searching Google for some time now but can't seem to find a solution to solve this. Thanks in advance to anyone that can help. I am about to start my advanced programming class in Jan and want to get up to par with my C skills so it's imperative to get this working in linux.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,528
    Please give some more details..
    Like how you're compiling it...and where you're running it from.
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    You're not printing a newline ('\n') at the end of the string.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by seanfmglobal View Post
    When running this code in windows everything works great. When doing so in Linux it runs but doesn't output anything to the screen.
    It does if you compile and run it exactly as you posted, but I think you have paraphrased See brewbuck's point; this has to do with flushing the stdout buffer (it also gets flushed on a clean exit).

    I am about to start my advanced programming class in Jan and want to get up to par with my C skills so it's imperative to get this working in linux.
    By the C standard, main() returns an int. You should compile with warnings enabled:

    gcc -Wall mycode.c

    and it would have told you, "warning: control reaches end of non-void function".
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    2,588
    is your program called 'test' by any chance?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rebuilding Debian AMD64 with ACPI/APM support, Debian DRI on XFree86
    By kawk in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-02-2006, 02:36 PM
  2. Windows XP and Debian GRUB
    By kawk in forum Tech Board
    Replies: 5
    Last Post: 03-26-2006, 06:09 PM
  3. This works on linux...but why not windows?
    By Kinasz in forum C Programming
    Replies: 6
    Last Post: 12-29-2005, 04:50 PM
  4. How come this only works in Windows nt/2000?
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-30-2002, 07:54 PM
  5. Replies: 6
    Last Post: 01-07-2002, 02:46 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21