compilation error of libprotoc with clang on windows when compiling a shared lib
Hi,
I am trying to compile protobuf with clang 10.0 && msvc142 on windows when compiling a shared lib
I am gettiing the following compilation error
src\google/protobuf/compiler/scc.h(63,21): error : 'google::protobuf::compiler::SCCAnalyzer<google::protobuf::compiler::js::(anonymous namespace)::DepsGenerator>' must have external linkage when declared 'dllexport' [C:.conan\fee85c\1\build_subfolder\source_subfolder\cmake\libprotoc.vcxproj]
I am using the following argument
-o protobuf:shared=True
and this sis the cmake output -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041. 10:19:56 -- The C compiler identification is Clang 10.0.0 with MSVC-like command-line 10:20:00 -- The CXX compiler identification is Clang 10.0.0 with MSVC-like command-line 10:20:00 -- Detecting C compiler ABI info 10:20:03 -- Detecting C compiler ABI info - done 10:20:03 -- Check for working C compiler: C:/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped 10:20:03 -- Detecting C compile features 10:20:03 -- Detecting C compile features - done 10:20:03 -- Detecting CXX compiler ABI info 10:20:06 -- Detecting CXX compiler ABI info - done 10:20:06 -- Check for working CXX compiler: C:/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
thanks
Sorry for the long delay. Are you still seeing this error in newer versions of protobuf?
Sorry for the long delay. Are you still seeing this error in newer versions of protobuf?
Yep
I am kind a shooting blind here, but can you check if add PROTOC_EXPORT to https://github.com/protocolbuffers/protobuf/blob/701dd83594c5d979481bc36ac58efea670a929ba/src/google/protobuf/compiler/cpp/helpers.h#L637 fixes this for you?
Same error remains :(
UPD: Version was 3.20.1, upgrade to 3.21.5 helped
Closing since newer version no longer has this problem.