Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

problem with compiling a c program

I am trying to compile a C program with the gcc command, it gives me the following error about 10 times:


warning: passing 'char *' to parameter of type 'unsigned char *' converts between

pointers to integer types with different sign [-Wpointer-sign]Pro


It does give me an executable file, but the file is not working properly. I had previously used the program on red hat and it worked fine.


Can any one help me figuring out how to make it work on my Mac. I have os X 10.9.5

Thanks!

iMac, Mac OS X (10.6.8)

Posted on Nov 18, 2015 11:48 AM

Reply
20 replies

Nov 24, 2015 11:10 AM in response to xyz2008

I don't know. it appears that your code makes too many assumptions about word size and file binary file layout, so I don't see the issue.


It would be best to create an XCode project, copy your code there and use the debugger (for example, if you were using the debugger it would tell you exactly what line is causing the segmentation fault) so you can figure out exactly what is being read into the program from the file and how to get things to work.

Nov 24, 2015 11:10 AM in response to Keith Barkley

Thanks!

I have never used Xcode, but thought I should give it a try. I started an Xcode project, created a .c file, copied and pasted the code into the file. Then I clicked in "run", "debugger" in the project. A new window showed up, says "debugger", but nothing happens in the debugger window, it says "no editor". And I can not paste anything into the debugger window where it says "no editor". Clearly I am not using it correctly. Would you please point me to a Xcode primer or tutorial?

problem with compiling a c program

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.