From f84c2ea5e2d1c2269be7002d17490cbefded6d7f Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 26 Aug 2013 10:30:39 +0200 Subject: [PATCH 1/2] Use #define instead of const char* for version. You can't initialize strings in header files, because they might be included from several source files and the linker will see several copies of the same string. --- include/osmpbf/osmpbf.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/osmpbf/osmpbf.h b/include/osmpbf/osmpbf.h index e354907..9dd8de1 100644 --- a/include/osmpbf/osmpbf.h +++ b/include/osmpbf/osmpbf.h @@ -7,10 +7,9 @@ // this describes the high-level OSM objects #include -namespace OSMPBF { +#define OSMPBF_VERSION "1.3.0" - // library version - const char *version = "1.3.0"; +namespace OSMPBF { // the maximum size of a blob header in bytes const int max_blob_header_size = 64 * 1024; // 64 kB From 2cd0806c927b3d43b85aa8195a99985fbe4dbc5d Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 30 Aug 2013 17:42:14 +0200 Subject: [PATCH 2/2] Compile with -fPIC This is needed on 64bit machines when the resulting static library will later be included in a dynamic library. --- src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 16c3e97..a735f45 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ -CXX = g++ -CXXFLAGS = -O3 +CXXFLAGS += -O3 -fPIC + AR = ar all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h