Skip to content

Windows: Linker errors with protobuf-generated code

Summary

Building libcaosdb in Debug mode has several problems:

  • The -DCMAKE_BUILD_TYPE=Debug option has to be set manually and is not preserved through Conan
  • Building in Debug mode results in linker errors
1>   Creating library C:/Code/LinkAhead/linkahead-cpplib/build/Debug/caosdb.lib and object C:/Code/LinkAhead/linkahead-cpplib/build/Debug/caosdb.exp
1>entity.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::CollectionValuesDefaultTypeInternal caosdb::entity::v1::_CollectionValues_default_instance_" (?_CollectionValues_default_instance_@v1@entity@caosdb@@3UCollectionValuesDefaultTypeInternal@123@A)
1>result_table.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::CollectionValuesDefaultTypeInternal caosdb::entity::v1::_CollectionValues_default_instance_" (?_CollectionValues_default_instance_@v1@entity@caosdb@@3UCollectionValuesDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::CollectionValuesDefaultTypeInternal caosdb::entity::v1::_CollectionValues_default_instance_" (?_CollectionValues_default_instance_@v1@entity@caosdb@@3UCollectionValuesDefaultTypeInternal@123@A)
1>entity.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::ScalarValueDefaultTypeInternal caosdb::entity::v1::_ScalarValue_default_instance_" (?_ScalarValue_default_instance_@v1@entity@caosdb@@3UScalarValueDefaultTypeInternal@123@A)
1>result_table.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::ScalarValueDefaultTypeInternal caosdb::entity::v1::_ScalarValue_default_instance_" (?_ScalarValue_default_instance_@v1@entity@caosdb@@3UScalarValueDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::ScalarValueDefaultTypeInternal caosdb::entity::v1::_ScalarValue_default_instance_" (?_ScalarValue_default_instance_@v1@entity@caosdb@@3UScalarValueDefaultTypeInternal@123@A)
1>connection.obj : error LNK2019: unresolved external symbol "const caosdb::info::v1::GetVersionInfoRequest::`vftable'" (??_7GetVersionInfoRequest@v1@info@caosdb@@6B@) referenced in function "public: __cdecl caosdb::info::v1::GetVersionInfoRequest::GetVersionInfoRequest(void)" (??0GetVersionInfoRequest@v1@info@caosdb@@QEAA@XZ)
1>connection.obj : error LNK2019: unresolved external symbol "const caosdb::info::v1::GetVersionInfoResponse::`vftable'" (??_7GetVersionInfoResponse@v1@info@caosdb@@6B@) referenced in function "public: __cdecl caosdb::info::v1::GetVersionInfoResponse::GetVersionInfoResponse(void)" (??0GetVersionInfoResponse@v1@info@caosdb@@QEAA@XZ)
1>result_table.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::SelectQueryHeaderDefaultTypeInternal caosdb::entity::v1::_SelectQueryHeader_default_instance_" (?_SelectQueryHeader_default_instance_@v1@entity@caosdb@@3USelectQueryHeaderDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::EntityDefaultTypeInternal caosdb::entity::v1::_Entity_default_instance_" (?_Entity_default_instance_@v1@entity@caosdb@@3UEntityDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::EntityResponseDefaultTypeInternal caosdb::entity::v1::_EntityResponse_default_instance_" (?_EntityResponse_default_instance_@v1@entity@caosdb@@3UEntityResponseDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::FileTransmissionIdDefaultTypeInternal caosdb::entity::v1::_FileTransmissionId_default_instance_" (?_FileTransmissionId_default_instance_@v1@entity@caosdb@@3UFileTransmissionIdDefaultTypeInternal@123@A)
1>transaction.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::RetrieveResponseDefaultTypeInternal caosdb::entity::v1::_RetrieveResponse_default_instance_" (?_RetrieveResponse_default_instance_@v1@entity@caosdb@@3URetrieveResponseDefaultTypeInternal@123@A)
1>download_request_handler.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::FileChunkDefaultTypeInternal caosdb::entity::v1::_FileChunk_default_instance_" (?_FileChunk_default_instance_@v1@entity@caosdb@@3UFileChunkDefaultTypeInternal@123@A)
1>download_request_handler.obj : error LNK2001: unresolved external symbol "struct caosdb::entity::v1::FileDownloadResponseDefaultTypeInternal caosdb::entity::v1::_FileDownloadResponse_default_instance_" (?

Expected Behavior

Building in Debug mode should be triggered by doing conan install -s build_type=Debug and should complete without errors.

Actual Behavior

What did the software actually do?

Steps to Reproduce the Problem

Please describe, step by step, how others can reproduce the problem. Please try these steps for yourself on a clean system.

Specifications

  • Version: 0.3-dev, Windows branch
  • Platform: Windows

Possible fixes

Do you have ideas how the issue can be resolved?