Why are my units “compiled with a different version” of my own files?

前端 未结 14 1987
误落风尘
误落风尘 2020-12-16 16:22

I\'m building a program that uses plugins. Unfortunately, the plugin framework\'s dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, an

14条回答
  •  攒了一身酷
    2020-12-16 16:57

    my case and solution:

    • we had a main application that builds an exe file and
    • some plugin projects that build dll files for this exe
      (the dll project also needs some of the applications source files)

    sometimes when compiling the dll files the "was compiled with a different version" problem occurred

    the problem was this:

    • the exe project was setup to create all it's dcu files in a separate directory: e.g. App\DCUs
    • the dll project had this DCUs directory in the search path, but also some of the application's source directories: e.g. App\Utils, App\Core, etc.
    • thus, when you compiled the dll project, some of the applications source files were compiled again (now possibly with a different version of other dependencies):
      and we ended up with 2 different dcu's of the same *.pas file

    the solution is easy: remove the App\DCUs directory from the dll project's search path.

提交回复
热议问题