All those questions contains answers and code which parses and splits std::string and not std::wstring.
When I'm trying to attempt such conversion I got following:
std::wstring sql;
std::wistringstream str( sql );
std::wstring s;
while( std::getline( str, s, ',' ) )
{
}
error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(479) : see declaration of 'std::getline'
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::wistringstream'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(468) : see declaration of 'std::getline'
error C2782: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : template parameter '_Elem' is ambiguous
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(468) : see declaration of 'std::getline'
1> could be 'char'
1> or 'wchar_t'
error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(448) : see declaration of 'std::getline'
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::wistringstream'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(395) : see declaration of 'std::getline'
error C2782: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : template parameter '_Elem' is ambiguous
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(395) : see declaration of 'std::getline'
1> could be 'char'
1> or 'wchar_t'
fatal error C1903: unable to recover from previous error(s); stopping compilation
This is with MSVC 2010.
As I said in the beginning - THIS IS NOT A DUPLICATE. This question is explicitly about std::wstring and not std::string.
What am I doing wrong?
TIA!!
Related
we observed strange compile errors when including files from OpenCV and spdlog in a Visual Studio 2017 project that uses conformance mode (/permissive-):
Build started...
1>------ Build started: Project: test, Configuration: Debug x64 ------
1>main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): error C2676: binary '<': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Ty=std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5385): note: see reference to function template instantiation 'const _Ty &std::max<std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>>(const _Ty &,const _Ty &) noexcept(<expr>)' being compiled
1> with
1> [
1> _Ty=std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>
1> ]
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(880): note: while compiling class template member function 'void spdlog::details::elapsed_formatter<Padder,std::chrono::seconds>::format(const spdlog::details::log_msg &,const tm &,spdlog::memory_buf_t &)'
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\type_traits(616): note: see reference to class template instantiation 'spdlog::details::elapsed_formatter<Padder,std::chrono::seconds>' being compiled
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder
1> ]
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(1216): note: see reference to class template instantiation 'std::is_convertible<spdlog::details::elapsed_formatter<Padder,std::chrono::seconds> *,_Ty *>' being compiled
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder,
1> _Ty=spdlog::details::flag_formatter
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): note: see reference to variable template 'const bool conjunction_v<std::negation<std::is_array<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > > >,std::is_convertible<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > *,spdlog::details::flag_formatter *>,std::is_convertible<std::default_delete<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > >,std::default_delete<spdlog::details::flag_formatter> > >' being compiled
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(1295): note: see reference to function template instantiation 'void spdlog::pattern_formatter::handle_flag_<spdlog::details::null_scoped_padder>(char,spdlog::details::padding_info)' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): error C2056: illegal expression
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The file that produced the errors is just:
#include <spdlog/spdlog.h>
#include <opencv2/opencv.hpp>
int main(int argc, char** argv)
{
return 0;
}
Changing the include order did not resolve the problem but the errors disappear when we use the 2019 compiler or when we enable the conformance mode. Switching to a newer compiler is not an option and i would like to keep conformance mode enabled.
Do you know what could be the causes of the problem and how to fix it?
Tested with (all share the issue):
spdlog: 1.4.1, 1.10.0
OpenCV: 4.0.1, 4.6.0
I have a Xamarin Android app that compiles and runs fine in DEBUG mode but won't compile in RELEASE mode.
The error that I'm getting is:
Mono.Linker.MarkException: Error processing method: 'System.String Microsoft.CodeAnalysis.SQLite.Interop.NativeMethods::sqlite3_errmsg(Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteHandle)' in assembly: 'Microsoft.CodeAnalysis.Workspaces.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String SQLitePCL.raw::sqlite3_errmsg(SQLitePCL.sqlite3)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute() MedLemnMobile.Android C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets 366
I've tried "Skip Linking" for Microsoft.CodeAnalysis.Workspaces.dll
I've tried "Skip Linking" for SQLitePCLRaw.core
Neither of the above tries at "Skip Linking" fixed the problem.
The app compiles fine if I set Linking to "None", but that is not recommended for RELEASE mode.
Any help would be greatly appreciated.
2/22/2021 - I turned up the verbosity on the Build Output and did a search for System.String. Here's what I found:
Activator call 'System.Object System.Reflection.Assembly::CreateInstance(System.String)' inside 'System.ValueTuple`2<System.Int32,System.Reflection.MethodInfo> CompilerClassLibNETStandard.Compiler::CompileInMemory(System.String)' is not yet supported (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'Xamarin.Forms.BindableProperty Xamarin.Forms.VisualElement::Xamarin.Forms.StyleSheets.IStylable.GetProperty(System.String,System.Boolean)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Void MedLemnMobile.ViewModels.GraphViewModel::MethodBeginModeReduce(System.String)' was detected with type name `MedLemnMobile.Classes.` which can't be resolved. (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Void MedLemnMobile.ViewModels.GraphViewModel::MethodBeginModeReduce(System.String)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::set_IsValid(System.Boolean)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::a(System.Collections.Generic.List`1<System.String>)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::set_Value(T)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type,System.Object[])' inside 'System.Void MedLemnMobile.Classes.Utils/a::MoveNext()' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Object Xamarin.Forms.BindablePropertyConverter::ConvertFromInvariantString(System.String)' was detected with type name `Xamarin.Forms.` which can't be resolved. (TaskId:466)
5> Expression call 'System.Linq.Expressions.MethodCallExpression System.Linq.Expressions.Expression::Call(System.Linq.Expressions.Expression,System.Reflection.MethodInfo,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)' inside 'System.Void MedLemnMobile.Behaviors.EventToCommandBehavior::a(System.Reflection.EventInfo,System.Object,System.Action`2<System.Object,System.EventArgs>)' was detected with 1st argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Java.Interop.__TypeRegistrations::Lookup(System.String[],System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Reflection.MethodInfo System.Reflection.RuntimeReflectionExtensions::GetRuntimeMethod(System.Type,System.String,System.Type[])' inside 'System.String Humanizer.EnumHumanizeExtensions::GetCustomDescription(System.Reflection.MemberInfo)' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.MethodInfo System.Reflection.RuntimeReflectionExtensions::GetRuntimeMethod(System.Type,System.String,System.Type[])' inside 'System.String Humanizer.EnumHumanizeExtensions::GetCustomDescription(System.Reflection.MemberInfo)' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'System.Void Microsoft.CodeAnalysis.CSharp.Shared.Lightup.NullableSyntaxAnnotationEx::.cctor()' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'System.Void Microsoft.CodeAnalysis.CSharp.Shared.Lightup.NullableSyntaxAnnotationEx::.cctor()' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String,System.Boolean)' inside 'System.Type Roslyn.Utilities.ReflectionUtilities::TryGetType(System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean Roslyn.Utilities.UICultureUtilities::TryGetCurrentUICultureSetter(System.Action`1<System.Globalization.CultureInfo>&)' was detected with type name `System.Globalization.CultureInfo, System.Globalization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a` which can't be resolved. (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Roslyn.Utilities.ObjectReader::ReadType()' was detected with argument which cannot be analyzed (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Object Microsoft.DiaSymReader.SymUnmanagedFactory::CreateObject(System.Boolean,System.Boolean,System.Boolean,System.String&,System.Exception&)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'T Microsoft.CodeAnalysis.DecodeWellKnownAttributeArguments`3::GetOrCreateData()' is not supported (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'T Microsoft.CodeAnalysis.EarlyDecodeWellKnownAttributeArguments`4::GetOrCreateData()' is not supported (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'System.Void Microsoft.CodeAnalysis.Diagnostics.AnalysisState/BlockAnalyzerStateData`2::.ctor()' is not supported (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Collections.Immutable.ImmutableArray`1<TExtension> Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference/Extensions`1::GetAnalyzersForTypeNames(System.Reflection.Assembly,System.Collections.Generic.IEnumerable`1<System.String>,System.Boolean&)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Roslyn.Utilities.ObjectReader::ReadType()' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String,System.Boolean)' inside 'System.Type Roslyn.Utilities.ReflectionUtilities::TryGetType(System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'System.Void Roslyn.Utilities.IDictionaryExtensions::MultiAdd(System.Collections.Generic.IDictionary`2<TKey,TCollection>,TKey,TValue)' is not supported (TaskId:466)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.String Microsoft.CodeAnalysis.SQLite.Interop.NativeMethods::sqlite3_errmsg(Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteHandle)' in assembly: 'Microsoft.CodeAnalysis.Workspaces.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String SQLitePCL.raw::sqlite3_errmsg(SQLitePCL.sqlite3)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: --- End of inner exception stack trace ---
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.AndroidTask.Execute()
5>Done executing task "LinkAssemblies" -- FAILED. (TaskId:466)
5>Done building target "_LinkAssembliesShrink" in project "MedLemnMobile.Android.csproj" -- FAILED.: (TargetId:492)
SUCCESS! I got it to work as follows:
1.) I discovered that setting Linking to "Sdk and User Assemblies" got the app to build OK, but then, when it ran, the user interface didn't behave well.
2.) So then, I added to my "Skip Linking" list, the name of my main Xamarin.Forms shared-code project.
And, thank goodness, that got it to build and run cleanly!
I tried clearing bin and obj, did many things and no help. In the end I turned off the "Multi-Dex" in my Android Property for it to compile. Below are my settings.
I have a struct in a DLL which, so far, has been used within that DLL, only.
I wanted to use the struct in another DLL, via pointer. So, I added __declspec(dllexport) to the struct definition. Simply adding that dll export statement is now causing the struct to fail to compile (not just the regular DLL export warnings). This is the first time that I've seen this behavior. I'm using Visual Studio 2019. I don't know what the underlying problem is.
What could be a reason that simply adding '__declspec(dllexport)' to a struct/class would make it fail compilation?
struct __declspec(dllexport) PipelineManager {
// ...
private:
std::unordered_map<std::string, std::string> mPathToName;
std::unordered_map<std::string, vko::PipelineLayout> mLayouts;
std::unordered_map<std::string, vko::GraphicsPipeline> mPipelines;
std::unordered_map<std::string, std::unique_ptr<GraphicsPipelineDef>> mDefs;
};
A chunk of the errors are below:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: 'std::pair<const _Kty,_Ty>::pair(const std::pair<const _Kty,_Ty> &)': attempting to reference a deleted function
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : see declaration of 'std::pair<const _Kty,_Ty>::pair'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : 'std::pair<const _Kty,_Ty>::pair(const std::pair<const _Kty,_Ty> &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : and
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Ty=ngen::rendo::GraphicsPipelineDef
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
// ...
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : see reference to function template instantiation 'std::unordered_map<std::string,std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>>::unordered_map(const std::unordered_map<_Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>> &)' being compiled
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : with
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : [
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : _Ty=ngen::rendo::GraphicsPipelineDef,
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : _Kty=std::string
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuVM.cpp)
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : see reference to class template instantiation 'std::unordered_map<std::string,std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>>' being compiled
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : with
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : [
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : _Ty=ngen::rendo::GraphicsPipelineDef,
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : _Kty=std::string
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuVM.cpp)
Trying to build my solution with MSBuild 15.0 from TFS2017 server, I have the following errors:
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\objidl.idl (702, 0)
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\objidl.idl(702,0): Error MIDL2072: inapplicable attribute : [ Type 'SNB' ( Interface 'IStorage' ) ]
and
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\objidl.idl (742, 0)
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\objidl.idl(742,0): Error MIDL2072: inapplicable attribute : [ Type 'SNB' ( Parameter 'snbExclude' ) ]
I have tried different versions of \include, \lib, \bin folders such as:
10.0.17134.0
10.0.16299.0
10.0.10586.0
10.0.10240.0
to no avail.
Any ideas or help how to resolve this issue are highly appreciated!
Thanks
First please make sure your local environment is as same as your build agent/server environment.
Besides, also take a look at this similar question, which maybe helpful to you:
error MIDL2072: inapplicable attribute : [annotation] [ Type 'SNB' ( Interface 'IStorage' )
Give a try with the solution mentioned in the link:
Remove all references on older SDK's binary directories in 'Executable
Directories' for 'VC++ Directories' in Properties for
'Microsoft.Cpp.x64.user'; otherwise the wrong (previous) version of
the MIDL compiler (that doesn't understand newer SAL/MIDL syntax) will
run with possible errors.
I'm trying to replicate the Visual Studio 2010 "Publish..." command (applicable to Web Application projects) where I would in the UI choose Publish Method: "File System".
My attempt at this is...
%msbuild% /t:MsDeployPublish /property:MsDeployServiceUrl="file:///d:\MyDeploymentFolder";MsDeployPublishMethod="File System" "d:\MySourceFolder\Project.csproj"
... and having tried a method of "FileSystem", "File System", "Local", and a few others.
The error I get implies that MsDeploy is still trying to push to an IIS server:
"D:\MySourceFolder\Project.csproj" (MsDeployPub
lish target) (1) ->
(MSDeployPublish target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web
.Publishing.targets(3847,5): error : Web deployment task failed.(The metabase k
ey '/lm/w3svc' could not be found.) [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : \r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : The metabase key '/lm/w3svc' could not be fo
und.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Unable to access the IIS configuration syste
m. Please make sure you have IIS 7 (or later) installed.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Retrieving the COM class factory for compone
nt with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} failed due to the followin
g error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REG
DB_E_CLASSNOTREG)). [D:\MySourceFolder\Project.csproj]
How can I target the file system for deployment, as Visual Studio normally lets me in the GUI?
As per my answer from Using MSBuild, how do I build an MVC4 solution from the command line (applying Web.config transformations in the process) and output to a folder?
msbuild ProjectFile.csproj /p:Configuration=Release ^
/p:Platform=AnyCPU ^
/t:WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
Or if you are building the solution file:
msbuild Solution.sln /p:Configuration=Release ^
/p:DeployOnBuild=True ^
/p:DeployDefaultTarget=WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
You can also target the project via the solution using the /t:SolutionFolder/Project:Target syntax:
msbuild Solution.sln /t:SolutionFolder/ProjectFile:WebPublish ^
/p:Configuration=Release ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
I gave up trying to get MSBuild to copy deployable web files (and not do anything else but that), so I scripted it in PowerShell and am really happy with the result. Much faster than anything I tried through MSBuild. Here's the gist (literally):
function copy-deployable-web-files($proj_path, $deploy_dir) {
# copy files where Build Action = "Content"
$proj_dir = split-path -parent $proj_path
[xml]$xml = get-content $proj_path
$xml.Project.ItemGroup | % { $_.Content } | % { $_.Include } | ? { $_ } | % {
$from = "$proj_dir\$_"
$to = split-path -parent "$deploy_dir\$_"
if (!(test-path $to)) { md $to }
cp $from $to
}
# copy everything in bin
cp "$proj_dir\bin" $deploy_dir -recurse
}
I don't think you are being specific enough with what you are telling msbuild.
Pulled this out of one of my bookmarks on the subject, hopefully it will help: http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild