# Why Error 110	error LNK2005:?

**URL:** https://discourse.itk.org/t/why-error-110-error-lnk2005/1595
**Category:** Beginner Questions
**Created:** [February 12, 2019, 6:09pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595 "2019-02-12T18:09:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Armando](https://discourse.itk.org/user_avatar/discourse.itk.org/armando/32/449_2.png) [@Armando](https://discourse.itk.org/u/Armando)
#### Post date: [February 12, 2019, 6:09pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/1 "2019-02-12T18:09:18Z")

</div>

In my project compiles fine in Debug mode, but in Release mode VS 2010 give me errors like these:

Error 79 error LNK2005: “void \_\_cdecl std::\_Xlength\_error(char const \*)” (?\_Xlength\_error@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj) E:\PROJECT\_01\msvcprt.lib(MSVCP100.dll)

Error 110 error LNK2005: “protected: \_\_thiscall std::basic\_ios\<char,struct std::char\_traits \>::basic\_ios\<char,struct std::char\_traits \>(void)” (??0?$basic\_ios@DU?$char\_traits@D@std@@@std@@IAE@XZ) already defined in TDICOMSerie.obj E:\PROJECT\_01\msvcprt.lib(MSVCP100.dll)

Why this?  
How to solve this?

Thanks

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)
#### Post date: [February 13, 2019, 1:51am UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/2 "2019-02-13T01:51:57Z")

</div>

@Armando,  
can you provide with a Minimal Working Example (MWE)? Which version of `ITK` are you using? Which version of `CMake` are you using? Which `CMake` flags have you enabled?

If we could have your `CMakeLists.txt`, your code if shareable and if self-contained, and concise, fellows would be in a better position to try to answer with a fix.

Also, note that if you are using ITK `master`, or any release tagged after `ITK 5.0 Alpha 1`, you will not be able to use a [Visual Studio older than 2015](https://discourse.itk.org/t/itk-5-0-alpha-1-modern-c/843).

Also, note that VS 2010 is almost 10 years old, and many folks are likely not to have access to such version. Also, full-feature, community-edition VS are released regularly since a few years now, and other excellent choices, such as CLion, exist, so you may want to upgrade or switch to other more modern IDE/builder.

JON HAITZ

---

<div class="post-metadata">

### Author: ![Armando](https://discourse.itk.org/user_avatar/discourse.itk.org/armando/32/449_2.png) [@Armando](https://discourse.itk.org/u/Armando)
#### Post date: [February 13, 2019, 3:38pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/3 "2019-02-13T15:38:44Z")

</div>

Hi Jon.

I am using version 4.13.0 of ITK and version 3.10.0 of CMake.  
The reason why I use Visual Studio 2010 is because I have a stereotactic surgery planning project developed in this environment, but it does not have registration and image fusion, which is what I am trying to do with ITK 4.13.0 and the time is against me. The ideal thing for me would be to start all over again with a modern IDE like Visual Studio 2015 or 2017.  
I thank you in advance for any suggestions. I’ve been trying to make this work for some time, but I’m a novice in the use of ITK and CMake.

Attached below the file CMakeLists.txt:

[CMakeLists.txt](https://discourse.itk.org/uploads/default/original/1X/c1a1845aae777f52832fc9153cd3b61de85d441e.txt) (18.6 KB)

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)
#### Post date: [February 13, 2019, 5:13pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/4 "2019-02-13T17:13:19Z")

</div>

@Armando,  
unfortunately, I do not have a VS 2010 version with me, so I will not be able to reproduce your problem.

In the event that other folks have the bandwith and the resources to have a go to your issue:

- The failure you are describing comes from your own project or from ITK?
- Are you able to build ITK 4.13.0 statically? And if your problem comes from your own project, does ITK build dynamically?
- The `CMakeLists.txt` provided looks exactly the `CMakeLists.txt` of ITK 4.13.0, so it is in the ITK 4.13.0 tag, no need to send it. Fellows having VS 2010 would be able to check out the tag, and build right away. Rather than the ITK `CMakeLists.txt`, people would need the `CMakeCache.txt` file of ITK to exactly reproduce the CMake flags you are using.
- In addition, if your problem lies when building your project, you will need to provide [sufficient information](https://discourse.itk.org/guidelines#sufficient-information).

If the build error lies in ITK, which I’d dare to say is unlikely thanks to the fact that prior to a release the folks make sure that the [CDash dashboard](http://testing.cdash.org/index.php?project=Insight) is green, you may need to read the release notes to see any pitfall and/or upgrade to ITK 4.13.1 hoping that it still matches your project’s requirements. Note that you will not find a VS 2010 build in the dashboard now due to the reason stated in my previous post.

Thanks.  
JON HAITZ

---

<div class="post-metadata">

### Author: ![Armando](https://discourse.itk.org/user_avatar/discourse.itk.org/armando/32/449_2.png) [@Armando](https://discourse.itk.org/u/Armando)
#### Post date: [February 13, 2019, 5:31pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/5 "2019-02-13T17:31:40Z")

</div>

Hi Jon.

The failure comes from my project, not from ITK. Because I have been able to do small test projects, for example, import and export DICOM images, using ITK 3.10.0 and I have not had any problems. Everything starts due to the configuration of the Project Properties. If I adapt the configuration to ITK, the project compiles without problems, but the project itself stops working and because it is a medical software for planning stereotactic surgeries I can not commit a change in its configuration. Initially this project was conceived since 1997 and did not contemplate the use of any graphic library. But now it is necessary to do it, and I want to take advantage of ITK and later VTK, but as far as I can verify it will not be possible for me.  
Previously I compiled ITK statically but in the Properties of the Debug mode of my project it makes use of “Runtime Library = Multi-threaded DLL (/ MD)” and then I got an error. This is the reason why I needed to compile ITK dynamically and it turned out that in Debug mode I compiled the project without problems but the problem appears in the compilation in Release mode.

I greatly appreciate your response and your indications.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)
#### Post date: [February 13, 2019, 6:41pm UTC](https://discourse.itk.org/t/why-error-110-error-lnk2005/1595/6 "2019-02-13T18:41:42Z")

</div>

@Armando,  
glad to read that the problem is not in ITK 😌.

If you are able to successfully use ITK 4.13.0 shared libraries in other smaller projects as you mentioned, then you should try to decompose your problem on your larger, surgery planning project to try to isolate it.

As said, if no MWE is provided, it will be difficult to spot the cause.

Also, note that if you use CMake to configure your project, you should not edit the project properties manually in your IDE.

The only thing that comes to my mind is that you should also specify correctly in your own project how your are linking to ITK, i.e. statically or dynamically. The [related CMake documentation](https://cmake.org/cmake/help/v3.0/command/add_library.html) may be helpful.

JON HAITZ
