Communication Problem with GCC 4.6.1

I am trying to compile and link a C ++ application that uses Boost libraries under the 64-bit version of Ubuntu Server 11.01. At first, without waiting for the packaged Boost libraries, I decided to compile them myself. Boost compiles without problems, but when I try to compile the application, the linker starts to throw errors, as if the libraries were not included.

builtinFunctions.o: In function `__static_initialization_and_destruction_0(int, int)':
builtinFunctions.cpp:(.text+0xcaab): undefined reference to `boost::system::generic_category()'
builtinFunctions.cpp:(.text+0xcab7): undefined reference to `boost::system::generic_category()'
builtinFunctions.cpp:(.text+0xcac3): undefined reference to `boost::system::system_category()'
builtinFunctions.o: In function `boost::system::error_code::error_code()':
builtinFunctions.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'
builtinFunctions.o: In function `boost::filesystem3::exists(boost::filesystem3::path const&)':
...

This is the Makefile I am using:

CC=g++
CFLAGS=-std=c++0x -c -Wall -I . -I ./boost_1_48_0/ -DBOOST_THREAD_USE_LIB

all: project

project: builtinFunctions.o main.o operators.o conversionUtils.o
        $(CC)   -L./boost_1_48_0/stage/lib/ \
                -lpthread -lboost_date_time-gcc46-mt-s-1_48 -lboost_program_options-gcc46-mt-s-1_48 \
                -lboost_filesystem-gcc46-mt-s-1_48 -lboost_system-gcc46-mt-s-1_48 builtinFunctions.o \
                main.o operators.o conversionUtils.o -o project

main.o: main.cpp
        $(CC) $(CFLAGS) main.cpp

operators.o: operators.cpp
        $(CC) $(CFLAGS) operators.cpp

conversionUtils.o: conversionUtils.cpp
        $(CC) $(CFLAGS) conversionUtils.cpp

builtinFunctions.o: builtinFunctions.cpp
        $(CC) $(CFLAGS) builtinFunctions.cpp

clean:
        rm -rf *o project

Anything else I could try besides the earlier version of GCC? Thank.

+2
source share
1 answer

The order of the libraries on the link line matters , but yours is wrong.

+4

All Articles