New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Obj C build errors in SnowLeopard


Post Reply New Thread Subscribe

 
Thread Tools
seekhelp

 
Member Since: Jul 21, 2010
Posts: 1
seekhelp is on a distinguished road

seekhelp is offline
Hi,

I am pretty new to XCode and Web Objects/ Objective C apps.

I am trying to build an existing Obj C app on my local machine that runs OS X 10.6.2 and getting the below error:

My XCode version is 3.2 and the cc used is gcc-4.0

regexp_stuff.m:1501:23: error: macro "strncpy" requires 3 arguments, but only 1 given
regexp_stuff.m: In function ‘_MOregsub’:
regexp_stuff.m:1501: error: ‘strncpy’ redeclared as different kind of symbol
regexp_stuff.m:1501: warning: unused variable ‘strncpy’


Please let me know if you have any pointers on how to debug this issue.

Thanks!
QUOTE Thanks
Nethfel

 
Member Since: Feb 25, 2009
Posts: 2,109
Nethfel is a glorious beacon of lightNethfel is a glorious beacon of lightNethfel is a glorious beacon of lightNethfel is a glorious beacon of lightNethfel is a glorious beacon of lightNethfel is a glorious beacon of light
Mac Specs: Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10

Nethfel is offline
It would really help to see your code - just seeing the error only gives part of the picture.

For example:

" regexp_stuff.m:1501:23: error: macro "strncpy" requires 3 arguments, but only 1 given "

would be given probably because there is a functioned defined as strncpy that is part of the strings library (in strings.h) and the prototype looks like:

char *strncpy(char *s1, const char *s2, size_t n);

so the compiler is wondering how come with a function that requires three parameters, you've only supplied 1.

in this:

regexp_stuff.m: In function ‘_MOregsub’:
regexp_stuff.m:1501: error: ‘strncpy’ redeclared as different kind of symbol
regexp_stuff.m:1501: warning: unused variable ‘strncpy’

In a function you have created, it appears you have defined strncpy as something else, which is giving the compiler a headache because it's already aware of a function called strncpy, you don't want local variables to have the same name as functions otherwise you run into ugly errors.

The last one is potentially nothing important - it's just stating you declared a variable but didn't actually use it in the function.

It's kind of like doing:

int addInts(int a, int b)
{
int x;

return a+b;
}

I declared x but didn't actually use it in the function - the compiler is letting you know that you have a variable in there that is either wasted space or you managed to forget to include it in what you were doing.

My Macs: Late 2013 rMBP w/ 750m; Mac mini G4, 1.25 GHz, 512m ram (server); Late 2011 11" MBA, 1.8GHz i7, 4Gig Ram, 256Gig SSD, HD3000; Powerbook 12" G4 1.33GHz running Debian as a server; Apple TV (1080p version)
QUOTE Thanks

Post Reply New Thread Subscribe


« Need help to create installer for Apache,mysql,php | Border around windows »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Help!: Browser errors, cannot fix MTEK Apple Notebooks 0 06-09-2010 11:53 PM
Do i need to do anything to repair/save my hard drive? oxband Apple Notebooks 3 04-09-2009 12:04 PM
to build or not to build? that's the question. james_falknor Other Hardware and Peripherals 1 02-23-2009 09:54 PM
Buy or Build a MacBook Pro? sobershea Apple Notebooks 3 08-11-2008 01:53 PM
XCode build hangs? robin OS X - Development and Darwin 3 01-12-2004 02:42 AM

All times are GMT -4. The time now is 08:14 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?