Building of executable and shared library with cmake, runtimelinker does not find dll

前端 未结 4 1336
梦毁少年i
梦毁少年i 2021-01-04 05:14

I am working with gcc(cygwin), gnu make, windows 7 and cmake.

my cmake testprojekt has the following structure

rootdir
|-- App
|   |-- app.cpp
|   +-         


        
4条回答
  •  轮回少年
    2021-01-04 05:41

    Your problem lies not with linker or compiler, but with the way Windows searches for DLL's.

    The OS will use the following algorithm to locate the required DLL's:

    Look in:

    1. The directories listed in the Application-specific Path registry key;
    2. The directory where the executable module for the current process is located;
    3. The current directory;
    4. The Windows system directory;
    5. The Windows directory;
    6. The directories listed in the PATH environment variable;

    Thus you have two reasonable options if you don't want to clutter the OS directories with your app-specific dll:

    1. Create an app-specific Path registry entry (I would go with this option);
    2. Put your DLL in the same folder as your EXE;
    3. Modify the PATH variable (but why would you do that, if you can go with option 1?);

提交回复
热议问题