Questions tagged [lnk2005]

117 questions
0
votes
1 answer

Visual Studio thinking that functions are already defined?

I have two files for a project I'm working on, one of my own writing and one written by a fellow student to serve as a sort of API. My problem is, the functions that are defined in the resource file are causing linker errors in VS2012. I'm getting…
ChaoticWeg
  • 291
  • 2
  • 15
0
votes
0 answers

Visual Studio 2012 linking issues

Visual Studio seems to be going wild recently. I am working on a simple c++ project, which includes one header with definitions + cpp file with declarations. That's it. Simple include guard, .h is included in both source files. Now i find myself…
Ghostli
  • 383
  • 1
  • 3
  • 11
0
votes
1 answer

Linker Error with templated class

I'm getting linker errors when trying to compile a templated class. I'm not too hot on C++ templated programming and the workings of the compiler (MSBuild/VS2012) and am having difficulty in determining what I've done wrong. I'm compiling with…
Gareth
  • 439
  • 5
  • 12
0
votes
1 answer

Each .cpp creating two LNK2005 errors

Okay, so I haven't used C++ for a couple months, and my one problem has always been using multiple headers. Currently my problem is all my headers for classes are linked to a main header, which the .cpp files use. I'm using ifndef's to make sure…
Fluzzarn
  • 55
  • 1
  • 6
0
votes
2 answers

LNK2005 errors using Direct3D9

I am trying to set up a basic application at the moment and I want to use Direct3D9 as the API to draw primitive shapes. For example, I want to create a circle which will be drawn by the circle object and a triangle in the triangle object etc. My…
Chris
  • 191
  • 1
  • 13
0
votes
3 answers

LNK2005, LNK1169 errors, "int __cdecl g(void)" (?g@@YAHXZ) already defined

I have 3 files in a Visual Studio project: test.cpp, date.cpp and main.cpp - test.cpp: int g() { return 0; } date.cpp: /*totally empty*/ main.cpp: #include "test.cpp" #include "date.cpp" int main() { return g(); } I understand that defining…
Anurag Kalia
  • 4,668
  • 4
  • 21
  • 28
0
votes
1 answer

getting LNK2005 and KNK1169 errors - including one class in another

I am getting these errors: Error 2 error LNK2005: "class std::basic_string,class std::allocator > __cdecl ToString(int)" (?ToString@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)…
traggatmot
  • 1,423
  • 5
  • 26
  • 51
0
votes
1 answer

handling link error with secondary .cpp and .h

First, the code snippets I'm having issues with; settings.h namespace { int WINDOW_WIDTH; int WINDOW_HEIGHT; bool FULLSCREEN; } void settings_init(); settings.cpp #include "DX_Constants.h" void settings_init() { WINDOW_WIDTH = 1920; …
Okari
  • 5
  • 1
  • 3
0
votes
1 answer

LNK2005 function pointer array "already defined" in .obj

Ok a little introduction into the issue: I'm working on a rendering engine(compiling in 32 bit mode) in C++/DirectX11 in Visual Studio 2012 running on Windows 7 - 64 bit OS and I have a strange link error that comes up in my Entity class (the…
ulak blade
  • 2,515
  • 5
  • 37
  • 81
0
votes
0 answers

LNK2005 errors despite matching runtime library (/MD)

I am attempting to use the OFELI library in a CLI/C++ solution containing both C# and C++ projects, under VS2010. In short, the UI is written in WPF, and computations are done in CLR-enabled C++. I downloaded the OFELI source, converted the…
DBaker
  • 1
0
votes
1 answer

C++ Unity Building a Library File, LNK2005

I'm new to unity builds. I've been doing some research and I've gotten great info from: http://buffered.io/posts/the-magic-of-unity-builds/ http://oj.blackapache.net.s3.amazonaws.com/UnityBuilds.html However, now that I started making changes to…
Pancho
  • 1
  • 1
0
votes
1 answer

LNK2005 and LNK1169 on debug objects

I have read about these two errors pretty extensively but despite all of my efforts I can not see the problem here. I have absolutely flooded my code with header guards to see if that will help, with no change in the result. here are each of the…
PrimitiveType
  • 301
  • 1
  • 6
0
votes
1 answer

LNK 2005 linker issues with msvcrt.lib(MSVCR90.dll)

I am sharing a static lib with a client. it is using vs2008 sp 1. i am using a third party lib which i built with the mfc with shared dll and /MD option release version I then built my own static lib which includes this third party lib with MFC…
Dave Powell
  • 671
  • 5
  • 14
  • 26
0
votes
2 answers

C++ LNK2005 'already defined' errors - files referencing themselves

I have inherited a C++ solution with 3 projects, one compiling to a .DLL, the other two to .EXEs . The DLL builds on its own fine, but the other two, when built, produce around 65 LNK2005 errors, the majority of which are referencing the same .obj…
0
votes
1 answer

Lots of LNK2005 errors

I'm trying (or rather struggling) to create a little Blackjack game. After some JavaScript courses and a few little projects I decided to switch to C++ and found it a little bit problematic, here is my…