Why there is no autocomplete from Intellisens? - visual-studio

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();
}

Related

Errors with find_if() & mem_fun1()

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?

Xcode beta 7 - Do-While loop SWIFT Error

The following code gives the error
Expected 'while' in 'do-while' loop
if let path = NSBundle.mainBundle().pathForResource("Chapters", ofType: "txt"){
do {
let stringFromFile = try String(contentsOfFile:path, encoding: NSUTF8StringEncoding)
var chapters: [String] = stringFromFile.componentsSeparatedByString("#")
chapters.removeAtIndex(0)
} catch {
print((error))
}
}
it was working fine before, but now it's giving me an error. Does anyone know why?
That code works for me as-is in the Playground with the appropriate Chapters.txt file in the Resources folder; XCode 7.1 Build 7B60. Did you try Shift-Command-K for a Clean Build?
Something does not seem right with your error message. With Swift 2.0, there are no more do-while loops. They have been replaced by repeat-while loops instead. As your code snippet shows, do has been repurposed for do-try-catch error handling.

error c2228 left of '.ptr' must have class/struct/union

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.

Clang does not compile a g++ project

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.

error C3121: cannot change GUID for class 'GeoPoint'

Error messages on build/re-build
e:\aaamac\aaamac\aaamacmprod\debug\jjjjgeo.tlh(1220): error C3121: cannot change GUID for class 'GeoPoint'
e:\aaamac\aaamac\aaamacmprod\debug\jjjjmap.tlh(488) : see declaration of 'GeoPoint'
click on the top line took me to a line in a file "aaaageo.tlh
struct __declspec(uuid("c0f74d34-2802-11d4-a320-006008bf4bdf"))
GeoPoint;
// [ default ] interface IGeoPoint
click on the bottom line took me to a line in a file "aaaamap.tlh"
struct __declspec(uuid("dd0257b9-5c91-473e-8203-bd472f51c44b"))
GeoPoint
{
double lat;
double lon;
};
aaaageo.tlh and aaaamap.tlh are generated codes from tlb files that I have no control over.
This code compiled, built, and ran using VC++ 6.
This code failed to compile/build using nVS2010.
What goes wrong? The tlh files are generated automatically so I cannot remove one of the GeoPoint entries using an editor.

Resources