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
Related
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)
Till now I've been using gcc for compiling my C++ code in Ubuntu 16.04 server edition. But since the latest features of C++17 (mainly concurrency and parallelism) are not convered by the latest gcc, while in clang many of them are, I've been starting to use clang. What surprised me is that for one of previously gcc-debugged C++ files, while compiling with gcc : gcc version 7.3.0 (Ubuntu 7.3.0-21ubuntu1~16.04) the execution goes fine, if compiling clang : clang version 6.0.0 (tags/RELEASE_600/final), the compilation says error: no member named 'make_optional' in namespace 'std' :
`marco#PC:~/marcoTensor$ g++ -std=c++17 bigMatricesDiv01.cpp
-obigMatricesDiv01
marco#PC:~/marcoTensor$ ./bigMatricesDiv01
Timer MTensor::Tensor2D A = randU2<double>(20,400,2.7,4.6) : 154 ms
Timer MTensor::Tensor2D B = randN2<double>(20,400,3,2.6) :111 ms
Timer MTensor::Tensor2D ApB = A/B :0 ms
marco#PC:~/marcoTensor$ clang++ -std=c++17 -stdlib=libc++ -w -fcolor-
diagnostics bigMatricesDiv01.cpp -obigMatricesDiv01 -lc++experimental
In file included from bigMatricesDiv01.cpp:1:
In file included from ./tensorTypes.h:1:
In file included from ./MTensorUtils.h:1:
In file included from ./MTensor.h:5:
In file included from ./GeneralUtils.h:16:
./FunctionalApproach.h:953:27: error: no template named 'optional' in
namespace 'std'
auto transform(const std::optional<T1>& opt, F f) ->
decltype(std::make_optional(f(opt.value()))){
~~~~~^
./FunctionalApproach.h:953:68: error: no member named 'make_optional' in
namespace 'std'
auto transform(const std::optional<T1>& opt, F f) ->
decltype(std::make_optional(f(opt.value()))){
~~~~~^
./FunctionalApproach.h:955:17: error: no member named 'make_optional' in
namespace 'std'
return std::make_optional(f(opt.value()));
~~~~~^
3 errors generated.
`
But: In FunctionalApproach.h:
#include <experimental/propagate_const>
#include <experimental/optional>
Any idea why clang says " no member named 'make_optional' in namespace 'std' "?
<experimental/optional> puts things in the std::experimental namespace. So that's where make_optional lives. The use of -lc++experimental does not mean that the contents of std::experimental are dumped into the std namespace.
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!!
I started learning Erlang, after read first chapter got strange error during compilation of module.
So when I try to compile demo.erl
-module(demo).
-author("alex").
-export([double/1]).
double(Value) ->
Value * 2.
So I try to compile it
1> m(demo).
and got
** exception error: undefined function demo:module_info/0
The only way to compile was
make:files(filelib:wildcard("demo.erl")).
I got demo.beam and now even after deletion of it m(demo). begin work.
Can anyone explain to me that compiler behavior?
To compile a module from the Erlang shell, use the c command:
1> c(demo).
{ok,demo}
The shell m command is for retrieving information about a compiled module:
2> m(demo).
Module: demo
MD5: 422cee9099e136c6dec13dd200927c63
Compiled: December 12 2015, 22:51
Object file: /tmp/demo.beam
Compiler options: []
Exports:
double/1
module_info/0
module_info/1
ok