# Fatal error LNK1120 and LNK2019

**URL:** <https://forums.unrealengine.com/t/fatal-error-lnk1120-and-lnk2019/422515>\
**Category:** C++\
**Tags:** unreal-engine, UE4, question, CPP, linking-error\
**Created:** [April 13, 2018, 9:10am UTC](https://forums.unrealengine.com/t/fatal-error-lnk1120-and-lnk2019/422515 "2018-04-13T09:10:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricardolo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ricardolo](https://forums.unrealengine.com/u/Ricardolo)\
**Post date:** [April 13, 2018, 9:10am UTC](https://forums.unrealengine.com/t/fatal-error-lnk1120-and-lnk2019/422515/1 "2018-04-13T09:10:16Z")

</div>

I have the errors LNK2019 and LNK1120 when I build my cpp.(Include a thirdpaty)I don’t know how to fix these errors and hope, that someone can help me.

HalfEdge.h

```
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include"glm/HalfEdgeMesh/HalfEdgeMesh.h"
#include "HalfEdge.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class TESTBLUEWRITE_API UHalfEdge : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UHalfEdge();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

		
public:
	UPROPERTY(BlueprintReadWrite)
		TArray<FVector> vetices;
	UPROPERTY(BlueprintReadWrite)
		TArray<int> Triangles;
	UPROPERTY(BlueprintReadWrite)
		TArray<FVector> normals;

	

	void init();
	glm::vec3 transfromFvectovec(FVector vector);
	TArray<glm::vec3> vecvetices;
};

```

halfedge.cpp

```
#include "HalfEdge.h"

// Sets default values for this component's properties
UHalfEdge::UHalfEdge()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	// ...
}

// Called when the game starts
void UHalfEdge::BeginPlay()
{
	Super::BeginPlay();

	// ...
	
}

// Called every frame
void UHalfEdge::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	// ...
}

void UHalfEdge::init()
{
	HalfEdgeMesh mesh;
	/*if (vetices.Num() <= 3)
		return;
	for (TArray<FVector>::TIterator it = vetices.CreateIterator(); it; ++it)
	{
		glm::vec3 tempvec3 = transfromFvectovec(*it);
		vecvetices.Push(tempvec3);
	}
	for (TArray<glm::vec3>::TIterator it = vecvetices.CreateIterator(); it; ++it)
	{
		mesh.CreateVertex(*it);
	}
	if (Triangles.Num() <= 3)
		return;
	for (TArray<int>::TIterator it = Triangles.CreateIterator(); it; )
	{
		std::vector<VertexHandle> vecprimitive;
		vecprimitive.push_back(long(*it));
		vecprimitive.push_back(long(*(it+1)));
		vecprimitive.push_back(long(*(it+2)));
		mesh.AddFace(vecprimitive);

		it += 3;
	}*/
}

glm::vec3 UHalfEdge::transfromFvectovec(FVector vector)
{
	float x = vector.X;
	float y = vector.Y;
	float z = vector.Z;
	float a[3] = { x,y,z };
	glm::vec3 vec(x, y, z);
	return vec;
}

```

halfedgemesh.h:`#ifndef **BuildingSketcher\_\_HalfEdgeMesh**  
#define **BuildingSketcher\_\_HalfEdgeMesh**  
#include  
#include  
#include “MeshVertex.h”  
#include “MeshHalfEdge.h”  
#include “MeshEdge.h”  
#include “MeshFace.h”

#include “Iterators/FaceHalfEdgeIterator.h”  
#include “Iterators/FaceIterator.h”  
#include “Iterators/VertexIterator.h”  
#include “Iterators/FaceVertexIterator.h”  
#include “Iterators/EdgeIterator.h”

typedef long VertexHandle;  
typedef long HalfVertexHandle;  
typedef long EdgeHandle;  
typedef long HalfEdgeHandle;  
typedef long FaceHandle;

class HalfEdgeMesh{  
public:  
struct EdgeKey{  
VertexHandle v1;  
VertexHandle v2;  
};  
private:  
/\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\* Next Available Handles \*  
\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
VertexHandle mNextVertex;  
HalfEdgeHandle mNextHalfEdge;  
EdgeHandle mNextEdge;  
FaceHandle mNextFace;

```
/* **********
 * Elements *
 * ********* /
MeshVertex **mVertices;
VertexHandle mNumVerts;
VertexHandle mVertsCapacity;

MeshHalfEdge **mHalfEdges;
HalfEdgeHandle mNumHalfEdges;
HalfEdgeHandle mHalfEdgeCapacity;

MeshEdge **mEdges;
EdgeHandle mNumEdges;
EdgeHandle mEdgeCapacity;

MeshFace **mFaces;
FaceHandle mNumFaces;
FaceHandle mFaceCapacity;

/* *****************************
 * Hash tables for performance *
 * **************************** /
std::map<EdgeKey, EdgeHandle> mEdgeTable;

```

public:

```
/* ****************************
 * Construction & Destruction *
 * *************************** /
HalfEdgeMesh(VertexHandle nVertices = 8, EdgeHandle nEdges = 12, FaceHandle nFaces = 6);
~HalfEdgeMesh();

/* *******************
 * Mesh Manipulation *
 * ****************** /
VertexHandle CreateVertex(glm::vec3 vertex);
void DeleteVertex(const VertexHandle& vHandle);
FaceHandle AddFace(std::vector<VertexHandle> vertices);
void DeleteFace(const FaceHandle& fHandle);
void DeleteEdge(const EdgeHandle& eHandle);
void Clear();

// TODO: Refactor to be removed
void UpdateIndexInformation();

/* ***********
 * Accessors *
 * ********** /
MeshVertex* GetVertex(const VertexHandle &vh ) { return mVertices[vh]; };
MeshFace* GetFace(const FaceHandle &fHandle) { return mFaces[fHandle]; };
VertexHandle GetNumberVertices() const { return mNumVerts; };
HalfEdgeMesh GetNumberHalfEdges() const { return mNumHalfEdges; };
EdgeHandle GetNumberEdges() const { return mNumEdges; }
FaceHandle GetNumberFaces() const { return mNumFaces; }

/* ***************
 * Stream Output *
 * ************** /
friend std::ostream& operator<< (std::ostream& o, const HalfEdgeMesh& mesh);

/* ***********
 * Iterators *
 * ********** /
friend class FaceHalfEdgeIterator;
FaceHalfEdgeIterator FaceEdgeBegin(const FaceHandle &face);
FaceHalfEdgeIterator FaceEdgeLast(const FaceHandle &face);

friend class VertexIterator;
VertexIterator VerticesBegin();
VertexIterator VerticesLast();

friend class FaceIterator;
FaceIterator FacesBegin();
FaceIterator FacesEnd();

friend class FaceVertexIterator;
FaceVertexIterator FaceVertexBegin(const FaceHandle &face);
FaceVertexIterator FaceVertexEnd(const FaceHandle &face);

friend class EdgeIterator;
EdgeIterator EdgeBegin();

friend class MeshFace;

```

private:  
void findOrCreateEdge(HalfEdgeHandle heHandle);

```
HalfEdgeHandle createHalfEdge(const VertexHandle& source, const VertexHandle& target);

/* *********************
 * Next Handle Updates *
 * ******************** /
void increaseNextVertex();
void increaseNextHalfEdge();
void increaseNextEdge();
void increaseNextFace();
void freeVertex(const VertexHandle& vHandle);
void freeHalfEdge(const HalfEdgeHandle& heHandle);
void freeEdge(const EdgeHandle& eHandle);
void freeFace(const FaceHandle& fHandle);

/* *******************
 * Alocation Methods *
 * ****************** /
void allocateVerticesIfNeeded(const VertexHandle& vHandle);
void allocateHalfEdgesIfNeeded(const HalfEdgeHandle& heHandle);
void allocateEdgesIfNeeded(const EdgeHandle& eHandle);
void allocateFacesIfNeeded(const FaceHandle& fHandle);

```

};

bool operator==(const HalfEdgeMesh::EdgeKey& ek1, const HalfEdgeMesh::EdgeKey& ek2);  
bool operator\<(const HalfEdgeMesh::EdgeKey& ek1, const HalfEdgeMesh::EdgeKey& ek2);  
#else  
typedef long VertexHandle;  
typedef long EdgeHandle;  
typedef long HalfEdgeHandle;  
typedef long FaceHandle;

class HalfEdgeMesh;  
#endif /\* defined( **BuildingSketcher\_\_HalfEdgeMesh** ) \*/`

`
