From: 7stud -- Date: 2008-03-23T05:23:08+09:00 Subject: Re: extending ruby with C++ 7stud -- wrote: > Jason Roelofs wrote: >> $CC = "g++" >> $CXX = $CC # for good measure. >> >> You should probably go looking around at tutorials on how to build C >> and C++ code before you go much farther into this project. >> >> Jason > > I know how to compile C++ programs from the command line or using an > IDE, but I don't know how to get extconf.rb to compile C++ programs or > what make does. > > > Where do those statements go? Inside extconf.rb? My current extconf.rb file: require 'mkmf' if (/mswin32/ =~ PLATFORM) $CFLAGS+=" -GX " # allow exceptions end $LIBS << " -lstdc++ -lc" $CC =="g++" $CXX == $CC create_makefile("Test") The output: $ ruby extconf.rb creating Makefile $ make g++ -fno-common -g -Os -pipe -fno-common -pipe -fno-common -pipe -fno-common -I. -I/usr/lib/ruby/1.8/universal-darwin8.0 -I/usr/lib/ruby/1.8/universal-darwin8.0 -I. -c Test.cpp cc -bundle -L"/usr/lib" -o Test.bundle Test.o -lruby -lpthread -ldl -lobjc -lstdc++ -lc /usr/bin/ld: Undefined symbols: __Unwind_Resume collect2: ld returned 1 exit status make: *** [Test.bundle] Error 1 $ls Makefile Test.cpp Test.o extconf.rb -- Posted via http://www.ruby-forum.com/.