I have compilation error in MSVC express 2013, when including "filesystem.h" on any .cpp file.
"error c2228 left of '.ptr' must have class/struct/union ".
It points to error in filesystem.h file, which is part of "\microsoft visual studio 12.0\vc\include"
template<class _Path> inline
bool remove(const _Path& _Pval)
{ // remove _Pval
-->> return (_Unlink(_Pval._Ptr()) == 0);
}
Thank you for any suggestion.
After repairing the installation of visual studio, the problem disappeared.
Related
How do I turn "Line numbers" on or off in an extension I am making?
I am changing something but either Visual studio does not notice, or I am changing the wrong record. There is a setting Tools->Options->Text Editor/All Languages/General/Line Numbers but I cannot find it in the SettingsStore so I am trying out CSharp instead.
The code that does the change:
var readOnly = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
var writeable = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
var value = readOnly.GetPropertyNamesAndValues(#"Text Editor\CSharp")["Line Numbers"];
// => value == 1
writeable.SetInt32(#"Text Editor\CSharp", "Line Numbers", 0);
value = readOnly.GetPropertyNamesAndValues(#"Text Editor\CSharp")["Line Numbers"]; // => 0
// => value == 0
Update
I exported all settings (menu:Tools->Import and exportsettings) and searched through the resulting file. There was nothing looking like "Line numbers" even though there are several similar entries in the menu:Tools->Options.
I am with Visual Studio 2022 17.0.1. When I export my settings there is a property ShowLineNumbers.
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="AllLanguages" RegisteredName="AllLanguages" PackageName="Text Management Package"/>
<ToolsOptionsSubCategory name="Basic" RegisteredName="Basic" PackageName="Text Management Package">
<PropertyValue name="TabSize">4</PropertyValue>
<PropertyValue name="ShowChanges">true</PropertyValue>
<PropertyValue name="ShowLineNumbers">true</PropertyValue>
I want to return Nan when item is not number.
double getValue(c_struct item)
{
if (!c_struct_isnumber(item)) {
return 0.0/0.0; // in linux is ok, but failed in windows
}
return item->value;
}
in linux is ok; but when I compile it in visual studio, then get an error:error C2124: divide or mod by zero.
anyone could help me?
Trying a C++ example with VS 2017 and Unreal I saw in the video once the instructor type ->GetF the intellisense appear but with me it does not so why is that ? I am getting also a red line error under the word GetWorld() "pointer to incomplete class type is not allowed" but the code compile fine !!
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
ActorThatOpen = GetWorld()->GetFirstPlayerController()->GetPawn();
}
I have code that worked well in Visual C++ 6.0. Now I need to get it working in VS 2017. I have some error messages when I compile, and I'm really not sure how to fix it. Here's the code:
class CTagDB : public CObject
{
...
bool SameTag (const CTagDB *TagDB) { return TagDB && *this == *TagDB; }
...
}
class CTagsDB : public CObject
{
...
std::vector<CTagDB*> m_Tags;
...
}
bool CTagsDB::IsDup(const CTagDB *TagDB) const
{
return std::find_if(m_Tags.begin(), m_Tags.end(),
std::bind2nd(std::mem_fun1(CTagDB::SameTag),
TagDB)) != m_Tags.end();
}
For this code I get the following errors:
error C2039: 'mem_fun1': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\map(16):
note: see declaration of 'std'
error C3867: 'CTagDB::SameTag': non-standard syntax; use '&' to create a pointer to member
error C3861: 'mem_fun1': identifier not found
error C2672: 'std::find_if': no matching overloaded function found
error C2780: '_InIt std::find_if(_InIt,_InIt,_Pr)': expects 3 arguments - 2 provided
Seeing the methods begin() & end(), I suspect that there is a problem with the way the vectors are being used, because originally the code was written without iterators. But this fragment of code is so clever as to be very difficult to decipher, let alone maintain (by me).
Can anyone help me figure out what is going on here and how to fix it?
When trying to compile a g++ project with the clang compiler, there is a strange error showing up.
Here is the snippet of the source file:
std::set<TTransportNetworkId> l_transportNetworkIds;
SelectionResultContainer l_searchResult = p_repo.rootMoc() / LnAny("LNBTS") / LnAny("LNMME");
BOOST_FOREACH(const SelectionResult & l_lnmmeSR, l_searchResult)
{
const MoLnmme & l_lnmme = l_lnmmeSR;
l_transportNetworkIds.insert(*l_lnmme.transportNwId);
}
The error message is:
conditional expression is ambiguous; 'rvalue_probe<Rrom::DataRep::SelectionResultContainer>' can be converted to 'Rrom::DataRep::SelectionResultContainer' and vice versa
BOOST_FOREACH(const SelectionResult & l_lnmmeSR, l_searchResult)
Conditions are:
The file compiles fine with gcc_4.3.2
clang in version 3.2 throws the above error
Already tried to include the latest boost library which results in the same error
My guess is that clang handles rvalue conditions differently than this gcc version does.
clang is supposed to be a drop-in-replacement for gcc, so how can one get rid of this error without touching the source file?
Are there any options in clang which somehow disables these kind of errors?!
UPDATE:
I could create an example source file, which you can reproduce for yourself:
#include <vector>
#include <boost/foreach.hpp>
class A : public std::vector<int>
{
public:
template <class T>
operator const T &() const;
};
void foo(){
A colA;
int b = 1;
BOOST_FOREACH(b, colA)
{
;
}
}
When compiled with clang 3.2 the above error is raised, with some additional insights to where exactly the error occurs:
error: conditional expression is ambiguous; 'rvalue_probe<A>' can be converted to 'A' and vice versa BOOST_FOREACH(b, colA)
expanded from macro 'BOOST_FOREACH' f (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL))
expanded from macro 'BOOST_FOREACH_CONTAIN' BOOST_FOREACH_EVALUATE(COL)
expanded from macro 'BOOST_FOREACH_EVALUATE' (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL))
This code is compiled without errors with gcc_4.7.2.
Any ideas why the two compilers behave differently?
I found the solution in this document, see http://www.boost.org/doc/libs/1_43_0/boost/foreach.hpp
Snippet:
// Some compilers do not correctly implement the lvalue/rvalue conversion
// rules of the ternary conditional operator.
# if defined(BOOST_FOREACH_NO_RVALUE_DETECTION)
So, when providing a -DBOOST_FOREACH_NO_RVALUE_DETECTION definition option to clang, the error disappears.
Still the question remains whether gcc or clang is right or wrong on this point.