Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top