0

I have a link problem in one of my projects which contains one exe and several static libs in a Visual Sutdio 2013 project.

The executable name is exec.library and rely on several static libs (intuition.library and graphics.libray to name a few). Intuition.library calls functions in graphics.library and of course, exec.library calls functions in both graphics.library and intuition.library.

This little drawing will help in understanding the interdependences :

              +------+
      +-------+ exec +-----+
      |       +------+     |
      |                    |
      |                    |
 +----v------+       +-----v----+
 | intuition +-------> graphics |
 +-----------+       +----------+

I have the following (french) error :

1>intuition.library.lib(OpenScreen.obj) : error LNK2019: symbole externe non résolu _ScreenToFront référencé dans la fonction _OpenScreen 1>D:\dev\MimicOS\SysCore\Debug\kernel.exe : fatal error LNK1120: 1 externes non résolus

ScreenToFront() and OpenScreen() functions are from intuition.library. When I compile intuition.library and graphics.library, everything is fine. On the other hand, when I compile exec.library (which uses intuition and graphics library), I have this error. What is confusing is that these two functions are derived from the same static lib (intuition.library) ...

From what I understand, the problem lies in the fact that intuition.libray (a static library) and graphics.library (which is a static library too) calls each others.

In my fruitless search on the net, I came across several articles that may be may be related: - http://blogs.msdn.com/b/vcblog/archive/2010/05/03/flexible-project-to-project-references.aspx - Unable to link my own static libraries

For those who have the courage to download the project (500KB), everything is available here: https://mimicos.codeplex.com/SourceControl/latest

Someone would have an idea?

Community
  • 1
  • 1
iliak
  • 61
  • 1
  • 4
  • The simplest explanation is usually the correct one. You *declared* ScreenToFont() in the intuition.h file so the compiler is happy. But your forgot to actually *write* it. So the linker is not happy. – Hans Passant Apr 07 '14 at 13:45
  • if there are cross dependencies the link order matters. Also try adding intuition library *again* at end of library link statement. – suspectus Apr 07 '14 at 13:53
  • I found a workaround by putting extern "C" in front each of my function declaration. Still need more investigations... – iliak Apr 11 '14 at 11:47

0 Answers0