Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 (C++) ToString() implementation not generated

You must be registered to post a reply.
Click here to register.

Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
amoldeshpande Posted - Oct 05 2020 : 2:23:37 PM
If I have a method named ToString() in my header file, I do not get an option to "Create Implementation" when I right click on the function name.


Microsoft Visual Studio Community 2019
Version 16.7.5

Visual Assist 10.9.2382.0
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c)1997-2020 Whole Tomato Software, LLC
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Nov 26 2020 : 12:44:33 PM
Simply adding this code to a .h file here, with a matching .cpp file, Create Implementation is offered quite happily for me.

If you press Alt-O in this header file, I am assuming it is a header file due to the "#pragma once" at the top, what happens? Even if there is no matching cpp file, Create Implementation should still be offered, the implementation is simply placed into the header file.

The only reason for Create Implementation to be missing from this menu is that VA thinks that an implementation already exists. What happens if you place the caret into "ClearShot" and press Alt-G?

If you rebuild your VA symbol database, does this have any effect on this problem?

VA Options -> Performance -> Rebuild symbol databases
amoldeshpande Posted - Nov 26 2020 : 12:58:14 AM
Got this bug in a non-UE4 project. At the bottom of below header file, the ClearSlot function does not give me the option to create implementation.

Note that this is the entire extent of code in this project.

#pragma once
#include <string>
#include <unordered_map>
#include <memory>
#include <queue>

namespace FluidHTN

class TaskRoot;
class ICompoundTask;
class ITask;
class Slot;

// Interface
class IDomain
    TaskRoot* Root;

    const TaskRoot& GetRoot() { return *Root; }
    virtual bool    Add(const ICompoundTask& parent, const ITask& subtask) = 0;
    virtual bool    Add(const ICompoundTask& parent, const Slot& slot) = 0;

// Base class
using namespace FluidHTN::Compounds;
class IContext;
class Domain : public IDomain
    std::unordered_map<int, std::shared_ptr<Slot>> _slots;

    Domain(const IContext& ctx, const std::string& name);

    virtual bool Add(const ICompoundTask& parent, const ITask& subtask) override;
    virtual bool Add(const ICompoundTask& parent, const Slot& slot) override;

    bool FindPlan(const IContext& ctx, std::queue<ITask>& plan);

    // ========================================================= SLOTS

    /// <summary>
    ///     At runtime, set a sub-domain to the slot with the given id.
    ///     This can be used with Smart Objects, to extend the behavior
    ///     of an agent at runtime.
    /// </summary>
    bool TrySetSlotDomain(int slotId, const Domain& subDomain);

    /// <summary>
    ///     At runtime, clear the sub-domain from the slot with the given id.
    ///     This can be used with Smart Objects, to extend the behavior
    ///     of an agent at runtime.
    /// </summary>
    void ClearSlot(int slotId);

} // namespace FluidHTN

Had to reset my Visual Studio 2019 install and reinstall VaX due to unrelated VS frustrations. Not sure if that had any relevance.
feline Posted - Oct 12 2020 : 05:08:10 AM
Have you had a look in the IDE settings? There are a lot of settings, so you may well be able to turn off the IDE feature that is getting in the way.

Another approach is to map the middle mouse button to VA's context menu:


For this bug, does this mean it seems a bit random?
amoldeshpande Posted - Oct 11 2020 : 1:36:58 PM
I'm using 4.24. I'll keep an eye on this bug and repost with more information if it happens again.

There were no preexisting implementations or macros. It just stopped working.

I mis-stated a bit when I said right-clicking to Create Implementation. I usually hover over the function name to get the annoying menu that fights with Visual Studio's matching feature (The VS menu is the one with the brush). I prefer VaX's way of taking me to the cpp instead of the peek way in VS, but I wish there was a way to turn the VS version off.

Anyway, like I said, I will post with more info if it recurs.
feline Posted - Oct 09 2020 : 2:50:20 PM
Which version of UE are you using?

What is the full signature of the ToString function? Does it have a UFUNCTION line, or any other macros attached to it?

If you place the caret into the function name "ToString" and press Alt-G what, if anything, happens? If VA believes that an implementation already exists for this function then it won't offer Create Implementation. In this case Alt-G should take you to what VA believes the implementation to be, if this is why the command is not being offered.

If you try copying this ToString declaration into a different class does this make any difference?

I have tried adding just the simple declaration:

FString ToString();

into a simple class:

class CPPFIRSTPERSON_API AFelineCharacter : public ACharacter
    // ...

and Create Implementation is working correctly for me. So I am wondering if macros on the function, the class, or perhaps what is above, or even below the ToString declaration in the class could be a factor here.

They shouldn't be, but something is clearly different between your system and mine, but I am not quite sure where to look.
amoldeshpande Posted - Oct 09 2020 : 12:06:46 PM
Ugh, sorry about not specifying that it's a UE4 project, so the type is FString. Other methods do work fine for generating implmentations.
feline Posted - Oct 07 2020 : 07:37:10 AM
What is the return type of this function?

Does Create Implementation get offered, and work, on other members of this class?

Can you please copy and paste the following simple test class into your solution, placing the class into a .h file with a matching .cpp file, and see if Create Implementation is offered here for you? It is being offered, and works correctly for me here, so I am wondering if the problem is somehow related to your class or file, rather than the function name its self.

class simpleFelineTestClass
	int m_nSimpleHeight;
	int m_nSimpleWidth;
	std::string ToString();

© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000