Skip to content

Windows: cannot convert argument 2 from 'const std::filesystem::path::value_type *' to 'const char *'

Summary

C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(594,3): error C2664: 'int linkahead_entity_entity_set_local_path(linkahead_entity_entity *,const char *)': cannot convert argument 2 from 'const std::filesystem::path::value_type *' to 'const char *' [C:\Code\caosdb\src\caosdb-cppinttest\build\test\test_clinkahead.vcxproj]
      C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(594,84):
      Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
      C:\Users\Joscha\.conan2\p\b\linka662655cb599e2\p\include\clinkahead.h(481,5):
      see declaration of 'linkahead_entity_entity_set_local_path'
      C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(594,3):
      while trying to match the argument list '(linkahead_entity_entity *, const std::filesystem::path::value_type *)'

C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(621,17): error C2664: 'int linkahead_transaction_transaction_retrieve_and_download_file_by_id(linkahead_transaction_transaction *,const char *,const char *)': cannot convert argument 3 from 'const std::filesystem::path::value_type *' to 'const char *' [C:\Code\caosdb\src\caosdb-cppinttest\build\test\test_clinkahead.vcx 
proj]
      C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(622,64):
      Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
      C:\Users\Joscha\.conan2\p\b\linka662655cb599e2\p\include\clinkahead.h(290,5):
      see declaration of 'linkahead_transaction_transaction_retrieve_and_download_file_by_id'
      C:\Code\caosdb\src\caosdb-cppinttest\test\test_clinkahead.cpp(621,17):
      while trying to match the argument list '(linkahead_transaction_transaction *, char *, const std::filesystem::path::value_type *)'
Cannot convert const wchar_t * to paramter type const char *

I.e., fs::path::c_str() returns a wide string on Windows.

Expected Behavior

What did you expect how the software should behave?

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.

  1. cmake --preset conan-default

Specifications

  • Version: 0.3-dev
  • Platform: Windows 11

Possible fixes

Do you have ideas how the issue can be resolved?

Edited by Joscha Schmiedt