I am trying to create a shared object (myLib.so) for a project I am doing. and I have created a separate eclipse 'project' to try and use/test the shared object - they are in the same workspace.
When I compile the project for the shared object (which uses the boost libraries thread etc) everything compiles file and I get no errors.
When I compile the test program and try to link it to myLib.so I get the following errors:
/path/lib.so: undefined reference to `boost::thread::interrupt()'
/path/lib.so: undefined reference to `vtable for boost::detail::thread_data_base'
/path/lib.so: undefined reference to `boost::detail::thread_data_base::~thread _data_base()'
/path/lib.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
/path/lib.so: undefined reference to `boost::thread::start_thread()'
/path/lib.so: undefined reference to `boost::this_thread::sleep(boost::posix_time::ptime const&)'
I am unsure if I am compiling myLib.so wrong, or if I have incorrect settings for the test project. As I say, when I compile myLib.so separately everything seems to work fine but when I compile the test program (which recompiles myLib.so for some reason) it seems to go wrong.
I have myLib.so's source code included in the compiler for the test project, and I have myLib.so included in the linker libraries for the test project.
If anyone could provide some assistance it would be greatly appreciated. Need any more info please ask.
Thanks,
Extra info:
Make file for the lib.so
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include *several-different-files*.mk mostly blank, LIB is blank
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: libmyLIB.so
# Tool invocations
libmyLIB.so: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -shared -o "libmyLIB.so" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(LIBRARIES)$(CPP_DEPS)$(CXX_DEPS)$(C_UPPER_DEPS) libPS.so
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
Makefile for the test setup
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: TestingmyLIB
# Tool invocations
TestingmyLIB: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: Cross G++ Linker'
g++ -L"/PATH" -o TestingLIB$(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(C++_DEPS)$(OBJS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) TestingLIB
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
Also one of the mk files the makefile for the test setup references (objects.mk) contains LIBS := -lmyLIB