# \[bug?\] SGraphNodeComment doesn't link

**URL:** <https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862>\
**Category:** UI\
**Tags:** unreal-engine, bug-report, slate, question\
**Created:** [September 18, 2016, 12:23pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862 "2016-09-18T12:23:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_22af6706](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_22af6706](https://forums.unrealengine.com/u/anonymous_user_22af6706)\
**Post date:** [September 18, 2016, 12:23pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/1 "2016-09-18T12:23:09Z")

</div>

So I think that 99% is that I’m doing something wrong but I can’t understand what. So I was thinking about using SGraphNodeResizable as a base for some of my own classes. But when I tried to compile a project - it gave me whole lot of unresolved externals. But then I thought maybe I’m doing something wrong and I created a blank c++ project (well, not blank, it was third person, but it doesn’t matter). Then I added next in my build file:

```
    PrivateDependencyModuleNames.AddRange(new string[] {
        "Slate",
        "SlateCore",
        "PropertyEditor",
        "UnrealEd",
        "EditorStyle",
        "GraphEditor",
        "AssetTools",
    });

```

I just copied that from my previous project. And then I added just this line to the constructor of game mode:

```
SGraphNodeComment SNode;

```

I didn’t forget about includes:

```
#include "SGraphNodeComment.h"
#include "SlateCore.h"
#include "SlateBasics.h"

```

And I pressed build. After that I received huge amount of errors:

log1.txt

I don’t think it’s normal, what’s wrong and how to fix it? Without that line (and include statement) everything compiles normally. Just including SGraphNodeComment.h will give those errors. And I used SGraphNodeComment, but SGraphNodeResizable doesn’t compile also. Just by including SGraphNodeResizable.h I receive this:  
log2.txt

So how it can be fixed?

UPD.  
So I’ve added a bunch of headers it complained about. So now extra includes look like this:

```
#include "EdGraph/EdGraphNodeUtils.h"
#include "ScopedTransaction.h"
#include "EditorStyleSet.h"

#include "SGraphNode.h"
#include "SGraphNodeResizable.h"
#include "SGraphNodeComment.h"

```

After that it compiled normally. But adding just one line breaks everything:

```
SGraphNodeComment SNode;

```

Now we get to the real question. Why I get all this unresolved externals?

log3.txt

Maybe I forgot to add somehting to the build file?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [September 19, 2016, 5:31pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/2 "2016-09-19T17:31:32Z")

</div>

Hey funbiscuit-

The errors appear to be coming from the MyProjectGameMode.cpp file. Can you try moving your includes to your game mode source file and try to compile again. If you are still getting unresolved externals then I would need to take a look at your project directly to further investigate. You can attach the project as an attachment if it is not too large. If it is large you can upload the project and provide a link to download it from. For privacy, you can set the post with the project information to private using the dropdown below the comment button.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_22af6706](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_22af6706](https://forums.unrealengine.com/u/anonymous_user_22af6706)\
**Post date:** [September 19, 2016, 5:38pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/3 "2016-09-19T17:38:49Z")

</div>

Hello,

These include are already in in my game mode source file. It is called MyProjectGameMode.cpp. Or I don’t understand what you’re saying.  
Anyway, here is the project:

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [September 20, 2016, 4:25pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/4 "2016-09-20T16:25:39Z")

</div>

Hey funbiscuit-

If you are still having troubles getting your code to compile, I found that variable being created needs to be a pointer instead. You can use this along with a forward declaration of the SGraphNodeComment rather than trying to include the SGraphNodeComment.h file itself to get the code to compile. With this I was able to get `class SGraphNodeComment* SNode;` to compile without the need to add additional includes or make any changes to the Build.cs file.

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_22af6706](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_22af6706](https://forums.unrealengine.com/u/anonymous_user_22af6706)\
**Post date:** [September 20, 2016, 5:30pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/5 "2016-09-20T17:30:06Z")

</div>

Uhm, it doesn’t work in the original project. I have a node that inherits from SGraphNode. And everything works correctly. But if I change inheritance from SGraphNode to SGraphNodeResizable or SGraphNodeComment - I get unresolved externals. Since the project is quite big - I can’t guarantee that I always use pointers, but I’m about 99% sure that I always use pointers (or references).  
So are you saying that I get unresolved externals only because somewhere I use non pointer version? And if so am I allowed to use references?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [September 20, 2016, 5:48pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/6 "2016-09-20T17:48:48Z")

</div>

In the project you sent, I was able to get the code to compile after moving the `SGraphNodeComment SNode;` and `SGraphNodeResizable SNode;` lines from MyProjectGameMode.cpp to the MyProjectGameMode.h and adding class and the asterisk (\*) as I mentioned in my previous response. You should also be able to remove the extra includes from MyProjectGameMode.cpp as well.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_22af6706](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_22af6706](https://forums.unrealengine.com/u/anonymous_user_22af6706)\
**Post date:** [September 20, 2016, 6:02pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/7 "2016-09-20T18:02:09Z")

</div>

It seems that by declaring just a pointer compiler optimized out a lot of stuff and that’s why you didn’t receive any unresolved externals. I just tried in that blank project to write this (just as always - in constructor of game mode):

```
UEdGraphNode* node;
TSharedPtr<SGraphNodeComment> SNode = SNew(SGraphNodeComment, node);

```

And it doesn’t work. It compiles but gives unresolved externals.  
Using TSharedRef also gives unresolved externals.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [September 20, 2016, 8:53pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/8 "2016-09-20T20:53:49Z")

</div>

Can you explain exactly what you are trying to accomplish? As mentioned, I was able to get the `SGraphNodeComment SNode;` line to compile after moving it from the constructor (.cpp file) to the class declaration (.h file) and editing it slightly to look like `class SGraphNodeComment* SNode;`. Your latest comment is the first mention of UEdGraphNode or declaring SNode as a TSharedPtr.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_22af6706](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_22af6706](https://forums.unrealengine.com/u/anonymous_user_22af6706)\
**Post date:** [September 21, 2016, 4:43am UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/9 "2016-09-21T04:43:55Z")

</div>

I’m trying to create my own graph editor based from unreal’s graph editor (soundcue and soundclass since they are the easier ones). And it is working as expected. But currently all my nodes inherit from SGraphNode so their size is fixed. I thought about making them resizable and I changed SGraphNode to SGraphNodeResizable and I immediately got all this unresolved externals.

SNew is a macro that is used in factory that creates all this nodes. So I must use the line

```
TSharedPtr<SGraphNodeComment> SNode = SNew(SGraphNodeComment, node);

```

There is just no other way to create a node. Because in a factory (which inherit from FGraphPanelNodeFactory) I need to override this function:

```
virtual TSharedPtr<class SGraphNode> CreateNode(UEdGraphNode* Node) const override;

```

As you see, from declaration of it I need somewhere in this function create TSharedPtr. And I cannot do it because it gives unresolved externals.  
Or are you saying that I cannot write

```
TSharedRef<SGraphNodeComment> SNode = SNew(SGraphNodeComment, node);

```

It seems to be a totally valid line of code.

---

<div class="post-metadata">

**Author:** ![fpwong](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fpwong/32/1194512_2.png) [@fpwong](https://forums.unrealengine.com/u/fpwong)\
**Post date:** [June 26, 2017, 6:52pm UTC](https://forums.unrealengine.com/t/bug-sgraphnodecomment-doesnt-link/370862/10 "2017-06-26T18:52:30Z")

</div>

From what I’ve figured out, it is because the _SGraphNodeResizable_ is not under an API. So where _SGraphNode_ is defined as:

```
class GRAPHEDITOR_API SGraphNode : public SNodePanel::SNode

```

_SGraphNodeResizable_ is defined like this without the GRAPHEDITOR\_API:

```
class SGraphNodeResizable : public SGraphNode

```

And similarily with _SGraphNodeComment_

```
class SGraphNodeComment : public SGraphNodeResizable`

```

So if you try to extend one of these classes with the API specified, it will spit out a ton of errors (the same ones in the your logs).

```
class MYPROJECT_API SMyGraphNodeComment : SGraphNodeComment

```

And if you remove the MYPROJECT\_API it compiles fine! **BUT** it screws up again when you go in your factory and try to create it

```
SNew(SMyGraphNodeComment, InNode);

```

This will spit out errors again. I am not sure why it fails at this point, I was thinking that the FNodeFactory also isn’t under an API but it is under the GRAPHEDITOR\_API.

I suspect adding GRAPHEDITOR\_API to both _SGraphNodeResizable_ and _SGraphNodeComment_ will fix this. I don’t know if someone forgot to add the GRAPHEDITOR\_API or if it was intended.
