Re: printf not working?

28 views
Skip to first unread message

Xavier Vergés

unread,
Apr 25, 2013, 1:22:39 AM4/25/13
to cocotr...@googlegroups.com
I was linking with -mwindows instead of -mconsole, so I was not building a console application and did not have stdout/stderr
My apologies for the noise.

-Xavier

On Sunday, April 21, 2013 8:47:53 PM UTC+2, Xavier Vergés wrote:
Hello

I'm new to cocotron and to objective-c, so please be patient if I'm missing something obvious.

My printf statement is not working on Windows, and I haven't got a clue. Writing to a file does work.

#import <Foundation/Foundation.h>
#import <stdio.h>

int main(int argc, const char * argv[])
{
#ifndef __APPLE__
    NSInitializeProcess(argc,argv);
#endif

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   
    printf("Helloooo!\n");
   
    FILE *ptr_file;
    ptr_file =fopen("output.txt", "w");
    fprintf(ptr_file,"Hi!\n");
    fclose(ptr_file);
   
    [pool release];
       
    return 0;
}


Tried it on Windows 7 - 64 bit and in Windows Vista - 32 bits.
Thanks for any hint.
-Xavier

Christopher Lloyd

unread,
Apr 26, 2013, 7:30:37 PM4/26/13
to cocotr...@googlegroups.com
No apologies needed, glad you got it working!

Chris
Reply all
Reply to author
Forward
0 new messages