conflicting declaration of C function ?

407 views
Skip to first unread message

Ed Hourigan

unread,
Nov 25, 2022, 11:28:51 AM11/25/22
to Protocol Buffers
I recently updated from 3.17.3  to 3.19.x and now I cannot compile:

/usr/local/google/protobuf-3.20.x/include/google/protobuf/endian.h:150:17: error: conflicting declaration of C function ‘uint32_t google::protobuf::internal::big_endian::FromHost(uint32_t)’

Nothing has changed in my build environment:
     Linux Ubuntu 22.04.1 
     gcc/g++ :  g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

If I switch back to 3.17.3,  the problem goes away.

Here is how I run protoc:
/usr/local/google/protobuf-3.20.x/bin/protoc -I=. --cpp_out=. 

And here is g++ compile line:

g++ -c -m64 -x c++ -std=c++17 -Wall -I/usr/local/google/protobuf-3.20.x/include -I/usr/local/google/protobuf-3.20.x/include/google

Ed Hourigan

unread,
Nov 25, 2022, 11:29:48 AM11/25/22
to Protocol Buffers
Sorry I meant upgrade to 3.20.x.   But I also got the same error with version 3.19.x.  

Ed Hourigan

unread,
Nov 25, 2022, 11:37:43 AM11/25/22
to Protocol Buffers
I get the same compile error with proto version 3.18.x too

Ed Hourigan

unread,
Nov 25, 2022, 12:02:07 PM11/25/22
to Protocol Buffers
Ok after digging in deeper on the examples,  using "-isystem" instead of "-I" in front of /usr/local/google/protobuf-3.20.x   fixed the problem.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/bd0ed5a3-9205-4c84-848c-1e08af7257bfn%40googlegroups.com.


--
--------------------------------------------------------------------------------------------------------------------------------------                                      
                                                   Ed Hourigan

                                         ed.ho...@gmail.com

-------------------------------------------------------------------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages