Questions tagged [lnk2005]

117 questions
1
vote
0 answers

C++ - How can I solve this LNK2005 "class std::basic_ostream > ... error?

I've been working on a C++ project for school and I'm currently facing this error : LNK2005 "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class…
1
vote
1 answer

error LNK2005 already defined - Compiler error when building after running

I'm trying to follow Riemer's DirectX with C++ tutorial. I have made a few changes, for example here I have made my InitializeDevice() function in a separate file (tdirect.cpp / tdirect.h). When I press F5 to compile and run, the program works…
Toneo
  • 492
  • 5
  • 9
1
vote
1 answer

Why does compiler add inlined class methods to lib?

Consider a class that belongs to a project linked to dynamic library (foo.dll), with foo.lib generated on the side too: class IMP_EXP_DIRECTIVE_MACRO Foo { void bar() { // do something } }; Then there is also another…
1
vote
1 answer

LNK2005 error when integrating LuaJit in UE4 (Unreal Engine 4)

lua51.lib(lua51.dll) : error LNK2005: _vsnprintf already defined in libcurl_a.lib(cryptlib.obj) GameName.Build.cs -> // Fill out your copyright notice in the Description page of Project Settings. using System.IO; using UnrealBuildTool; public…
Skits
  • 21
  • 5
1
vote
1 answer

What is causing the "error LNK2005: already defined in .obj" s errors in my code?

I would like to know what is causing a double definition linker error in my code. It confuses me because there doesn't seem to be any reason for it. I don't think I'm #includeing any .h files in places that would cause this, as my file's #includes…
user9182770
1
vote
1 answer

C++ linker error when using same .h-file in inherited class

I have two classes: ClassA and ClassB. ClassB inherits the ClassA. There is a utility.h-header file included to both classa.cpp and classb.cpp so that I can use the method round(double number, int precision) from the utilities.h in both…
Canna
  • 13
  • 2
1
vote
1 answer

printf / _vsnprintf_l / already defined in msvcrtd.lib(MSVCR120D.dll)

I have project where I want to import library. When I do that (import .lib files from library) and than call any function from library I get following errors: "C:\Uz\myproj.vcxproj" (default target) (1) ->(Link target) -> …
user7042812
  • 113
  • 1
  • 12
1
vote
3 answers

Which #includes in main.cpp should I use (LNK2005 already defined)

I have the following classes: // Buffer.cpp #include "MonoSample.h" #include "Buffer.h" #define INBUFFERSIZEBLOCK 1024 // input block size #define MAXBUFFERSIZE 1000000 // max buffer size (1MB) #pragma warning…
crende
  • 21
  • 3
1
vote
1 answer

LNK2005 happen when include .h file in .c file

I am trying to implement a Stack in a program using C language. I separate them into 3 file. First, stack.h file. It include some essential declaration and function such as Pop, Push for a stack. Second, stack.c file. It is a file implement the…
Hugo
  • 129
  • 1
  • 3
  • 14
1
vote
1 answer

LNK2005-Error when declaring a function in a .hpp-File

I'm building a program, and need a function to check if the mouse is on an object. I wrote the function and created a new .hpp-File, because multiple Files in my project will use the function. The File is called HitboxDetec.hpp. The function I wrote…
D4RKS0UL23
  • 45
  • 1
  • 5
1
vote
3 answers

error LNK2005 constructor already defined

hello i've got a little problem with my code. //club.h #pragma once #include #include #include #include #include"Palmares.h" #include"Stade.h" #include"Joueur.h" #include"Date.h" using namespace std; class Club …
ShorKy
  • 77
  • 10
1
vote
1 answer

LNK1169 and LNK2005 errors in C

I'm getting the following errors when trying to compile my code: LNK1169: one or more multiply defined symbols found LNK2005: [function name] already defined in main.obj ^^^ Error LNK2005 for every function Here's my current code: main.c #define…
user3562806
  • 219
  • 1
  • 2
  • 6
1
vote
2 answers

error LNK2005: already defined on including a header file twice

I need to edit and access a few variables across multiple cpp files in a visual studio project. So I created a header file with a namespace containing all the variables I require as follows: namespace windowdimension{ TCHAR…
annie1994
  • 143
  • 1
  • 6
1
vote
3 answers

error LNK2005 - What am I doing wrong here?

I've been given some source code (as part of an assignment) that I'm supposed to modify, but I can't get the unmodified version of the code to compile and I'm tearing my hair out. (To be clear - this code is for a school assignment on hash tables,…
b1skit
  • 327
  • 4
  • 16
1
vote
2 answers

LNK2005, C++/CLI, no idea

I have a pure C++ code, there are two classes: Dictionary and Training. I would like to make a WinForms project using these classes. So, I have two forms and need to share my class member to both, like a global variable. I tried to make it in that…