Project Builder Question (External Related)

James Spencer jspencer78 at mac.com
Mon Sep 6 06:21:33 EDT 2004


On Sep 5, 2004, at 12:38 PM, K wrote:

> I am sorry for my Project Builder ignorance I am used to using Code 
> Warrior (*NIX development) and Visual Studio (Win32 Development).  I 
> seems to be experiencing linking problems with the stanard C/C++ 
> library.
>
> Simple example:
>
> NOTE: This is a C version I experience simular problems with may c++ 
> version.
>
> #include <stdlib.h>
>
> void somefunction( <revolution/mc signature>)
> {
>   int  result ;
>   char *mcResult_ptr = calloc( (sizeof(int)*8+1), sizeof(char) ) ;
>
>   //Do something..
>
>   itoa( result, mcResult_ptr, 10 ) ;
>
> }
>
>
> Here even though itoa is included via stdlib.h the linker will be 
> unable to locate it.  I assume the glibc/c-lib is  not being linked.  
> How do I correct this in Project Builder?

You really should ask this in a basic C group or list as it not only 
has nothing to do with Rev but actually has nothing to do with 
ProjectBuilder (or Xcode which is what you should be using) or, for 
that matter, isn't really a linker error.  (It is also hard to give  
help when you don't give us the error messages but the immediate error 
is fairly obvious in the above).

Having said that, the problem in your example is that itoa() is NOT 
part of the standard lib and a basic search of stdlib.h will tell you 
that it is not declared there.  If  you try to build this code in 
CodeWarrior, with the standard settings, you will get a compile time 
error for failing to declare itoa.  (I don't know what Visual Studio 
will do; they may have defined itoa() in the environment; if not, then 
you will get some kind of error there but it could be a compiler error 
like CW or a linker error like Xcode.)  In XCode (and I assume PB but 
its been awhile since I've used it) the standard settings will permit 
the code to compile but then the linker complains that you haven't 
defined atoi and I assume this is what the error message you are 
getting tells you.  You can test that the std library is in fact being 
linked simply by commenting out the itoa line and the code should link 
even though you have a call to calloc() which is in the standard 
library.

James P. Spencer
Rochester, MN

jspencer78 at charter.net

"Badges??  We don't need no stinkin badges!"



More information about the use-livecode mailing list