Thread: netbeans compiles but nothing happens on run

  1. #1
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59

    netbeans compiles but nothing happens on run

    Hi guys, I have a long C project, it seems to work fine, it builds correctly, but from 2 days it won't run.

    Or better, it compiles, it runs but nothing happens. I've also put a printf at the head of the main, but i get nothing from running my project.

    If you want I can post my code or part of it, but I think it's not very much a problem of code, it simply stopped running my code, everything I write, my code compiles correctly but nothing on run screen.

    What could it be for you?

  2. #2
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    ps: i'm using W7 64bit and cygwin as compiler.

  3. #3
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    update: i tried with a simple "hello world" project and it works. Could it be some stuff with stdlib or stdio libraries? Everything happened after a wrong getchar (that i deleted after).

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Have you tried running it from the console, rather than inside the IDE?

    Have you tried putting a breakpoint on the first statement in main, then tried to debug it?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    uhm, i tried to put a breakpoint after the printf too, and all the variables seems to be ok.

    i tried to declare a int x=10; and printf("%d",x), and when debugging it says x=10, but it does not print it, don't know why. Didn't try to execute on console, I'll try now, but I can't get why a normal "hello world" project works with printf...

  6. #6
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    but I can't get why a normal "hello world" project works with printf...
    Would that suggest there is something wrong with your other code...
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  7. #7
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    yeah, that's why i don't think it's a netbeans problem anymore, but what kind of problem can it be?
    it compiles fine, it runs but nothing happens, while printf is 1st operation in main.c after variables declaration.
    And when I debug all declarations and operations around the printf seems to be fine...

  8. #8
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    but what kind of problem can it be?
    If everything is tickety boo then you have to say it is environmental - but posting your code will help confirm that
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  9. #9
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    Sorry I didn't understand your 1st sentence!

    I have no problem posting my code, but it's veeery veery long and main function calls for lot of other functions, I don't think it would be helpful to you the main function, or it would?

  10. #10
    Registered User DeliriumCordia's Avatar
    Join Date
    Mar 2012
    Posts
    59
    Ok i did it.
    I was desperate, I couldn't figure out what was happening.
    In my desperation i've seen that both of my printf where normal printf, and wandering in google somebody suggested that the problem could be related to stdout flush, and suggested to add \n to the line.

    I added \n to my printf and now it works.

    My question is: why? What happened? Why if i add a line it works and correctly prints, if i use normal prints nothing was displayed? What is behind this behavior? It's the 1st time something like this happens to me, it would have to be a choice of the user the use of \n or not in the prints, isn't it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Netbeans and while loop
    By Harry Kashouli in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2012, 05:43 AM
  2. Getting C Compiler for NetBeans
    By Soulzityr in forum C Programming
    Replies: 3
    Last Post: 03-30-2010, 09:00 AM
  3. compiling C++ with NetBeans
    By Furious5k in forum C++ Programming
    Replies: 6
    Last Post: 02-14-2010, 01:38 PM
  4. How to compile code C/C++ in Netbeans
    By zaracattle in forum C++ Programming
    Replies: 5
    Last Post: 09-28-2006, 06:27 PM