문제

Forgive the convoluted title.

The setup for this problem is as follows:

I have an open source lib I have built into a bunch of .libs (VTK if you were curious)

I have a library that uses the aforementioned static lib. Lets call it Lib A.

I also have an application that uses the aforementioned library (i.e. VTK) AND also uses Lib A.

During build time, I get a linker error telling me that a function called from Lib A has already been defined in a library that is linked to the application (error: LNK2005)

Any ideas on how to fix this short of switching everything to be dynamically linked?

도움이 되었습니까?

해결책

Alright. I figured out what I was doing wrong.

Lib A was using the statically built version of VTK while the main app was linking against a dynamic-linked version of VTK.

So the problem really was that I had the same functions defined in a .lib and a .dll which caused the linker to fail.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top