The problem: At the moment im compiling on Ubuntu but my server is running Fedora/Redhat. Ubunutu uses boost 1.42 and linux latest at this very moment is 1.41. So what i decided was to download the boost lib and put it in the folder of my workspace
Here is the directory structure
/workspace
/myprogram
/src
/main.cpp
/Debug
/main
/boost_1_42_0
/downloaded from boost.com
In my main.cpp, i have this code
#include "../../boost_1_42_0/boost/regex.hpp"
Is this even posible or am i barking up the wrong tree. I have tried to compile it but it failed (ofcourse) with 13 errors
If i missed some information please ask for it, il try providing it
Make File (My Program is called vlogd)
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include src/class/vException/subdir.mk
-include src/class/mysqlcppapi/subdir.mk
-include src/class/mysqlcppapi/row/subdir.mk
-include src/class/mysqlcppapi/query_results/subdir.mk
-include src/class/mysqlcppapi/query/subdir.mk
-include src/class/mysqlcppapi/fields/subdir.mk
-include src/class/mysqlcppapi/exceptions/subdir.mk
-include src/class/mysqlcppapi/datetime/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: vlogd
# Tool invocations
vlogd: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -L/usr/lib64/mysql -L../../boost_1_42_0/lib/ -o"vlogd" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) vlogd
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
Object File
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS := -lmysqlclient -lboost_regex
No need to include using full path, if you use
gccjust specify the correct include path and link pathThus, all
#include <boost/...>headers and libs will be first searched in your local boost.Edit
Following the question in the comment.
By default -l will search for
.solibraries. So if boost is built with e.g.libboost_regex.soandliboost_regex.a, then by default you will link to the.so. If you’re linked to.so, on the working server you need to have correct versions of these libraries (several boost versions can be installed).If you want to link implicitly to the static versions, either use the full path
or
or (in newer versions of
ld)Having the binary with
lddcommand you may see its shared library dependencies and check if boost ones are among them