Specifying the Link Path for Visual Studio 2017 DLLs

Asked 2 years ago, Updated 2 years ago, 92 views

I am using Visual Studio 2017.

Visual Studio 2017 Solution Explorer displays:
Where is the full path to the DLL import library shown in libraries and
Should I specify it?
Enter a description of the image here

Each library may have different folders, so if you cannot specify them uniformly,
I think so.
I think I will specify it for each library, but
I don't know where to specify it.

Please let me know.

Designated path picture for each library
Enter a description of the image here

visual-studio

2022-09-30 16:10

1 Answers

There may be some misunderstanding about the environment you are assuming before the subject issue/question.

The following is a revised version:

  • The solution explorer pane lists the .lib files that are dependent (if changed, trigger build processing) and are treated similar to .cpp and the extension .lib is taken into account and passed to the linker.

  • If you combine the user macros with the relative path in the properties of the ACAP_STATD.lib file in the lower right corner of the second screenshot, the full path information also appears to show valid path information.Also, in the second screenshot, there is a yellow triangle on the icon of the file!Marked to indicate invalid specification.

  • The error is that the file was not found during the link process, and the error message shows that the user macro is not deployed here.Perhaps the method specified in the Solution Explorer pane will not deploy user macros.

  • If you specify a library file in the Solution Explorer pane, you will need to specify the actual path information itself without using the user macro.
    If you want to enable user macros, you will need to add specifications separately using the following methods:

The .lib file is listed in the Solution Explorer pane, which lists dependent (if changed, triggers build processing) files, is treated similar to .cpp, and is passed to the linker with the extension .lib.

If you combine the user macros in the relative path in the ACAP_STATD.lib file properties in the second screenshot, the full path information also appears to be valid, but if you hit the full path with a mouse pointer, you'll see an invalid value.Also, in the second screenshot, there is a yellow triangle on the icon of the file!Marked to indicate invalid specification.

The error occurred because the corresponding file was not found during the link process, and the error message shows that the user macro is not deployed here.Perhaps the user macro will not be deployed by the method specified in the Solution Explorer pane.

If you specify a library file in the Solution Explorer pane, you will need to specify the actual path information itself without the user macro.
If you want to enable user macros, you will need to add specifications separately using the following methods:

Two steps are required as shown in the article below.
How to use the library and configure VisualStudio

How to browse library files (*.lib)

1. allows you to specify multiple directories, and 2. does not need to specify a path, just specify a filename.

1. and 2. only, specify the full path there.

Alternatively, if you want to specify a full path, you can write it in the source code instead of repeating the manual operation as described above.
(If you specify the directory in 1. above, you can specify the file name instead of the full path.)

You can also run the *.lib file directly in the program.
Example) #pragma comment(lib, "C:\Program Files\OpenCV\lib\cv.lib")

In any case, up to four configurations must be configured by multiplying the Debug, Release, and Win32, x64 modes.

When describing in the source code, consider switching to the #ifdef macro as follows:
Configuring Library|[C++] Getting Started with VisualStudio

Specifying Library Files
How to write directly to source code

Write the lib file to use using pragma comment on the header to use.The example above is OpenCV 2.3, which is divided by preprocessors because there are two types of lib files: debug and release.


2022-09-30 16:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.