error: explicit instantiation of 'assign' does not refer to a function template, variable template, member function, member class, or static data member
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the supplied CSharpAPI.h and Setup method, then reproduce generation for the CSharp binding with Clang. Inspect the generated Std-symbols.cpp, especially the explicit std::basic_string::assign declaration, and compare it with the available libc++ overloads. Done means the generated C++ compiles without the reported explicit-instantiation error.
Written by the indexing model from the issue text.
Description
Brief Description
I want to generate a simple binding that converts C# System.string arguments to C++ std::string. After generating the code there's an error in the file Std-symbols.cpp.
OS: macOS Catalina
IDE: Qt Creator
Used headers
#include <string>
class CSharpAPI
{
public:
CSharpAPI();
void SetVariable(std::string strName, std::string strValue);
};
Used settings
public void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = GeneratorKind.CSharp;
options.GenerateInternalImports = true;
var module = options.AddModule("MyModule");
module.IncludeDirs.Add("../Include");
module.Headers.Add("CSharpAPI.h");
}
Target: Clang
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
Other settings
Stack trace or incompilable generated code
Std-symbols.cpp:
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
#define _LIBCPP_HIDE_FROM_ABI
#include <string>
#include <new>
template std::allocator<char>::allocator() noexcept;
template std::basic_string<char, std::char_traits<char>, std::allocator<char>>::basic_string();
template std::basic_string<char, std::char_traits<char>, std::allocator<char>>::~basic_string() noexcept;
template void* std::basic_string<char, std::char_traits<char>, std::allocator<char>>::assign(const char*);
template const char* std::basic_string<char, std::char_traits<char>, std::allocator<char>>::data() const noexcept;
Error:
Std-symbols.cpp:10: error: explicit instantiation of 'assign' does not refer to a function template, variable template, member function, member class, or static data member
template void* std::basic_string<char, std::char_traits<char>, std::allocator<char>>::assign(const char*);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string:1055:18: note: candidate template ignored: could not match 'const type-parameter-0-0 &' against 'const char *'
assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); }
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string:1072:19: note: candidate template ignored: could not match 'const type-parameter-0-0 &' against 'const char *'
assign(const _Tp & __t, size_type __pos, size_type __n=npos);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string:1084:9: note: candidate template ignored: failed template argument deduction
assign(_InputIterator __first, _InputIterator __last);
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string:1093:9: note: candidate template ignored: failed template argument deduction
assign(_ForwardIterator __first, _ForwardIterator __last);
^
- Dominant language
- C#
- Stars
- 3.4k
- Forks
- 541
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mono/CppSharp
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
How to get started Open
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100