boost with cygwin

B

blackfin

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
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'm not using the INCLUDES variable as I found all the libraries in the
/usr/lib. Can someone help.

Thanks
S.
 
N

Nate Barney

I'm not using the INCLUDES variable as I found all the libraries in the
/usr/lib. Can someone help.

You need both the include directories and the libraries available at
compile time.


Nate
 
B

blackfin

Thanks for your reply 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 ..
 
O

Old Wolf

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
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

It looks like you have not included the Boost headers in your
source files. You need something like:

#include "boost.h"

at the top of cash_flow.h (I dont' know what the exact file
name you need is; ask on a Boost forum).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top