Building cpp library fails on OS X with malloc and free not being declared in 
scope
-----------------------------------------------------------------------------------

                 Key: THRIFT-856
                 URL: https://issues.apache.org/jira/browse/THRIFT-856
             Project: Thrift
          Issue Type: Bug
          Components: Library (C++)
    Affects Versions: 0.4
         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
            Reporter: James Clarke
             Fix For: 0.4


Building cpp library fails for me on OS X with the following error:
{quote}
Making all in cpp
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. 
-I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF 
.deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo 
'./'`src/Thrift.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src 
-Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  
-fno-common -DPIC -o .libs/Thrift.o
src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const 
char*, ...)':
src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
src/Thrift.cpp:59: error: 'free' was not declared in this scope
make[3]: *** [Thrift.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
{quote}

Adding cstdlib to the includes in Thrift.cpp fixes this problem. 

I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to