Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-12-01 05:12:53


Shan wrote:
> Hi,
>
> I'm trying to use boost in a cygwin enviroment. I've installed the
> boost-1_33_1 libraries using the cygwin setup program. I have a
> makefile to compile a simple program but I keep getting the error.
>
> $ make
> g++ -c -O3 cash_flow.cpp

Note the command line, the boost include path isn't there, so you need to
adjust your makefile.

I'm also a little surprised not to see a message that <boost/shared_ptr.hpp>
couldn't be found. Just tripple checking, but you did include that file in
cash_flow.cpp didn't you :-)

You don't need to link to any external libs to use shared_ptr either.

HTH, John.

> In file included from cash_flow.cpp:6:
> cash_flow.h:12: error: `boost' has not been declared
> cash_flow.h:12: error: ISO C++ forbids declaration of `shared_ptr'
> with
> no type
> cash_flow.h:12: error: expected `;' before '<' token
> make: *** [cash_flow.o] Error 1
>
> I'm new to Unix like environments and am not able to setup the
> makefile properly. Below is what I have
>
> TARGET = main
> CPP = g++
> CPPFLAGS = -O3
> INCLUDES = -I/usr/include/boost-1_33_1
> LDFLAGS =
> LIBS = -lboost_1_33_1
> SOURCES = $(wildcard *.cpp)
> DEPENDS = $(SOURCES:%.cpp=%.d)
> OBJECTS = $(DEPENDS:%.d=%.o)
> TMPS = $(wildcard *.hpp~) $(wildcard *.cpp~)
>
> $(TARGET) : $(OBJECTS)
> $(CPP) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
>
> clean :
> rm -rf $(TARGET) $(DEPENDS) $(OBJECTS) $(TMPS)
>
> $(DEPENDS) : %.d : %.cpp
> set -e; $(CPP) -MM $(CPPFLAGS) $< \
> | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
> [ -s $@ ] || rm -f $@
>
> $(OBJECTS) : %.o : %.cpp
> $(CPP) -c $(CPPFLAGS) $<
>
> .PHONY : clean
>
> include $(DEPENDS)
>
>
> I also tried using the includes/library names
>
> I tried that as well
>
> INCLUDES = -I/usr/include/boost-1_33_1
> LDFLAGS = -L/usr/lib
> LIBS = -lboost_1_33_1
>
> and
>
> $(OBJECTS) : %.o : %.cpp
> $(CPP) -c $(CPPFLAGS) $(INCLUDES) $<
>
> Still get the same error ..
>
> Can someone tell me which libboost*.a should I point to as there are
> many .. for eg to use boost::shared_ptr?
>
> Thanks
> S.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net