I'm trying to use the protobuf librairy but I have some struggle compiling it in my existing project.
The example program works fine but not my project. I think there is some conflicts with OpenGL defined types.
c++ -MMD -MP -I ./header -I ./bomberlib -Wall `pkg-config --cflags --libs protobuf` -g -pg -o srcs/main.o -c srcs/main.cpp
In file included from ./header/NetworkProtocol.pb.h:9:0,
from ./header/Networking.hh:18,
from ./header/Menu.hpp:26,
from ./header/Engine.hpp:15,
from srcs/main.cpp:11:
/usr/local/include/google/protobuf/stubs/common.h:173:9: error: reference to ‘int64_t’ is ambiguous
typedef int64_t int64;
^
In file included from /usr/include/stdlib.h:314:0,
from /usr/lib/gcc/x86_64-linux-gnu/4.8/include/mm_malloc.h:27,
from /usr/lib/gcc/x86_64-linux-gnu/4.8/include/xmmintrin.h:38,
from /usr/lib/gcc/x86_64-linux-gnu/4.8/include/emmintrin.h:35,
from ./bomberlib/glm/gtc/../core/setup.hpp:559,
from ./bomberlib/glm/gtc/../glm.hpp:89,
from ./bomberlib/glm/gtc/type_precision.hpp:47,
from ./bomberlib/Input.hh:4,
from ./header/AObject.hpp:16,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
/usr/include/x86_64-linux-gnu/sys/types.h:197:1: note: candidates are: typedef long int int64_t
__intN_t (64, __DI__);
^
In file included from ./bomberlib/Input.hh:4:0,
from ./header/AObject.hpp:16,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
./bomberlib/glm/gtc/type_precision.hpp:94:24: note: typedef glm::detail::int64 glm::int64_t
typedef detail::int64 int64_t;
^
In file included from ./header/NetworkProtocol.pb.h:9:0,
from ./header/Networking.hh:18,
from ./header/Menu.hpp:26,
from ./header/Engine.hpp:15,
from srcs/main.cpp:11:
/usr/local/include/google/protobuf/stubs/common.h:173:9: error: ‘int64_t’ does not name a type
typedef int64_t int64;
^
/usr/local/include/google/protobuf/stubs/common.h:178:9: error: reference to ‘uint64_t’ is ambiguous
typedef uint64_t uint64;
^
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdint.h:9:0,
from /usr/include/inttypes.h:27,
from ./bomberlib/SDL_stdinc.h:66,
from ./bomberlib/SDL_main.h:25,
from ./bomberlib/SDL.h:67,
from ./bomberlib/SdlContext.hh:3,
from ./header/AObject.hpp:17,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
/usr/include/stdint.h:55:27: note: candidates are: typedef long unsigned int uint64_t
typedef unsigned long int uint64_t;
^
In file included from ./bomberlib/Input.hh:4:0,
from ./header/AObject.hpp:16,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
./bomberlib/glm/gtc/type_precision.hpp:216:25: note: typedef glm::detail::uint64 glm::uint64_t
typedef detail::uint64 uint64_t;
^
In file included from ./header/NetworkProtocol.pb.h:9:0,
from ./header/Networking.hh:18,
from ./header/Menu.hpp:26,
from ./header/Engine.hpp:15,
from srcs/main.cpp:11:
/usr/local/include/google/protobuf/stubs/common.h:178:9: error: ‘uint64_t’ does not name a type
typedef uint64_t uint64;
^
In file included from ./header/NetworkProtocol.pb.h:24:0,
from ./header/Networking.hh:18,
from ./header/Menu.hpp:26,
from ./header/Engine.hpp:15,
from srcs/main.cpp:11:
/usr/local/include/google/protobuf/repeated_field.h: In member function ‘void google::protobuf::RepeatedField<T>::Reserve(int)’:
/usr/local/include/google/protobuf/repeated_field.h:754:50: error: call of overloaded ‘max(int&, int&)’ is ambiguous
max(total_size_ * 2, new_size));
^
/usr/local/include/google/protobuf/repeated_field.h:754:50: note: candidates are:
In file included from /usr/include/c++/4.8/list:60:0,
from ./bomberlib/Input.hh:3,
from ./header/AObject.hpp:16,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]
max(const _Tp& __a, const _Tp& __b)
^
In file included from ./bomberlib/glm/gtc/.././core/func_common.hpp:428:0,
from ./bomberlib/glm/gtc/../glm.hpp:102,
from ./bomberlib/glm/gtc/type_precision.hpp:47,
from ./bomberlib/Input.hh:4,
from ./header/AObject.hpp:16,
from ./header/Player.hpp:14,
from ./header/Camera.hpp:14,
from ./header/Engine.hpp:14,
from srcs/main.cpp:11:
./bomberlib/glm/gtc/.././core/func_common.inl:304:29: note: genType glm::max(const genType&, const genType&) [with genType = int]
GLM_FUNC_QUALIFIER genType max
This problem is a real headache. Do you know what is the origin and how I can fix it ?