0

I have an annoying CMake issue. I have a project with more than one directories, such as (theoretically):

  • compiler -> generates compiler.exe and compiler.dll
    • This is pure C++
    • However the compiler.dll needs to link to machine.dll (see below) due to use of some fancy things ...
    • and the compiler.dll is a SHARED library
  • machine -> generates machine.exe and machine.dll -
    • this is half C and half C++. The C++ part needs to link to compiler.dll

So here a circular dependency arose, which is very elegantly solved on Linux, however on MSVS2012, the linker complains with LNK2019 ... unresolved external symbol. Which is understandable, since when I see the compilation, the order is the following:

  1. it compiles the machine's C files
  2. it tries to compile the machine's C++ files ... and here it fails at the linking, since the compilers' C++ files were not compiled yet...

How can I resolve this issue?

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
  • 1
    http://stackoverflow.com/questions/362830/circular-dependencies-between-dlls-with-visual-studio –  Jan 02 '14 at 19:18
  • Fix the circular dependency by separating the "core" part of compiler into its own dll which you build first. – André Jan 03 '14 at 08:19
  • Problem was solved by converting the shared libraries into static ones and extracting the necessary parts into a shared library, without keeping the circularity – Ferenc Deak Jan 03 '14 at 13:52

1 Answers1

0

Problem was solved by converting the shared libraries into static ones and extracting the necessary parts into a shared library, without keeping the circularity.

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167