x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Linker Errors using DetourNode.h in Navmesh module

Hey,

I am trying to change the FindPath function in ARecastNavMesh. Everything works except I wrote a custom class that has dtNavMeshQuery as parent with a findCustomPath() function.

Visual studio compiles fine but when UE4 rebuilds the binaries it gives me these linker errors:

 [2/3] Link UE4Editor-MyGame.dll
    Creating library D:\Unreal\GAME\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame.lib and object D:\Unreal\GAME\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame.exp
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl dtNodePool::clear(void)" (?clear@dtNodePool@@QEAAXXZ) referenced in function "public: unsigned int __cdecl dtNavMeshCustomQuery::findCustomPath(class UObject const *,unsigned __int64,unsigned __int64,float const *,float const *,class dtQueryFilter const *,struct dtQueryCustomResult &,float *)const " (?findCustomPath@dtNavMeshCustomQuery@@QEBAIPEBVUObject@@_K1PEBM2PEBVdtQueryFilter@@AEAUdtQueryCustomResult@@PEAM@Z)
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "public: struct dtNode * __cdecl dtNodePool::getNode(unsigned __int64)" (?getNode@dtNodePool@@QEAAPEAUdtNode@@_K@Z) referenced in function "public: unsigned int __cdecl dtNavMeshCustomQuery::findCustomPath(class UObject const *,unsigned __int64,unsigned __int64,float const *,float const *,class dtQueryFilter const *,struct dtQueryCustomResult &,float *)const " (?findCustomPath@dtNavMeshCustomQuery@@QEBAIPEBVUObject@@_K1PEBM2PEBVdtQueryFilter@@AEAUdtQueryCustomResult@@PEAM@Z)
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl dtNodeQueue::dtNodeQueue(int)" (??0dtNodeQueue@@QEAA@H@Z) referenced in function "public: unsigned int __cdecl dtNavMeshCustomQuery::findCustomPath(class UObject const *,unsigned __int64,unsigned __int64,float const *,float const *,class dtQueryFilter const *,struct dtQueryCustomResult &,float *)const " (?findCustomPath@dtNavMeshCustomQuery@@QEBAIPEBVUObject@@_K1PEBM2PEBVdtQueryFilter@@AEAUdtQueryCustomResult@@PEAM@Z)
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl dtNodeQueue::~dtNodeQueue(void)" (??1dtNodeQueue@@QEAA@XZ) referenced in function "public: void * __cdecl dtNodeQueue::`scalar deleting destructor'(unsigned int)" (??_GdtNodeQueue@@QEAAPEAXI@Z)
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "private: void __cdecl dtNodeQueue::bubbleUp(int,struct dtNode *)" (?bubbleUp@dtNodeQueue@@AEAAXHPEAUdtNode@@@Z) referenced in function "public: unsigned int __cdecl dtNavMeshCustomQuery::findCustomPath(class UObject const *,unsigned __int64,unsigned __int64,float const *,float const *,class dtQueryFilter const *,struct dtQueryCustomResult &,float *)const " (?findCustomPath@dtNavMeshCustomQuery@@QEBAIPEBVUObject@@_K1PEBM2PEBVdtQueryFilter@@AEAUdtQueryCustomResult@@PEAM@Z)
 Module.MyGame.cpp.obj : error LNK2019: unresolved external symbol "private: void __cdecl dtNodeQueue::trickleDown(int,struct dtNode *)" (?trickleDown@dtNodeQueue@@AEAAXHPEAUdtNode@@@Z) referenced in function "public: unsigned int __cdecl dtNavMeshCustomQuery::findCustomPath(class UObject const *,unsigned __int64,unsigned __int64,float const *,float const *,class dtQueryFilter const *,struct dtQueryCustomResult &,float *)const " (?findCustomPath@dtNavMeshCustomQuery@@QEBAIPEBVUObject@@_K1PEBM2PEBVdtQueryFilter@@AEAUdtQueryCustomResult@@PEAM@Z)
 Module.MyGame.cpp.obj : error LNK2001: unresolved external symbol "struct FThreadSafeStaticStat<struct FStat_STAT_Navigation_RecastPathfinding> StatPtr_STAT_Navigation_RecastPathfinding" (?StatPtr_STAT_Navigation_RecastPathfinding@@3U?$FThreadSafeStaticStat@UFStat_STAT_Navigation_RecastPathfinding@@@@A)
 D:\Unreal\GAME\MyGame\Binaries\Win64\UE4Editor-MyGame.dll : fatal error LNK1120: 7 unresolved externals

It is mainly LNK2019... I did add "Navmesh" to my dependencies and included "DetourNode.h" where all the classes and structs are declared.
Does anyone have any idea how to solve these errors? I have been searching a while on my own now but cannot make sense of it.

Help greatly appreciated :)

Elias

Product Version: UE 4.12
Tags:
more ▼

asked Jul 27 '16 at 02:53 PM in C++ Programming

avatar image

PasteDog
1.2k 24 18 53

avatar image PasteDog Jul 28 '16 at 11:30 AM

Okey so after searching for a while I found out it has to do with the "DetourNode.h" file.

The classes in there use inline functions and the the compiler gives the errors if I use the functions which code are in the "DetourNode.cpp". Because he can't find them or something?

Is there a way I can make the compiler compile "DetourNode.h" completly first?

avatar image PasteDog Jul 29 '16 at 08:03 AM

I was able to resolve the last Linker error : LNK2001 by commenting out SCOPE_CYCLE_COUNTER(STAT_Navigation_RecastPathfinding);

No progress on the other errors :/

avatar image PasteDog Aug 01 '16 at 07:20 AM

Bump,

If you want to try it out yourself add "Navmesh" to your dependencies and include "DetourNode.h" and try to create a dtNodeQueue, this is already enough to get the linker errors...

edit: DetourQueue -> dtNodeQueue

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Visual Studio is giving you errors because it can't find the definitions of the functions you are using from DetourNode.h. This is because those functions have not been flagged for export by the Unreal API. You did the right thing by adding the module to your dependencies, but that only gives you access to exported functions/classes. Notice how the class rcContext in Recast.h contains the keyword "NAVMESH_API". This means that this class is publicly accessible by adding the module. If you have a source build of the engine, you can export the functions you need yourself. For example, if you want access to the dtNodePool class and its functions, replace line 47 of DetourNode.h with "class NAVMESH_API dtNodePool". This should resolve the linking errors, since the compiler will now be able to access those function and class definitions. You will need to manually add the API keyword before every non-exported class you want to use and then recompile the engine from source.

more ▼

answered Aug 01 '16 at 06:01 PM

avatar image

geoffrey1218
106 6 4 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question