problem with creating .lib file in VisualStudio

Anonymous
2023-03-30T16:11:32.86+00:00

I am tring to build .dll file in which includes basic function and .cpp file for purpose also depends on other .lib file.

but when I try to build my dll project. It only builds .dll. But I need to create .lib file. Can you tell me what could be wrong. for reference I have added some picture below.User's image

User's image

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
938 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.1K Reputation points
    2023-03-30T18:52:18.3733333+00:00

    I think that you should define the BUILD_MY_DLL macro (in Project Properties, C/C++, Preprocessor Definitions, for all of configurations and platforms), so that the SHARED_LIB is expanded to __declspec(dllexport).

    In addition, make sure that the functions are implemented in shared_lib.cpp and have the correct names and parameters.

    Show details about shared_lib.cpp if this does not help.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. RLWA32 40,276 Reputation points
    2023-03-30T23:34:15.01+00:00

    The Visual Studio Dynamic-Link Library project template will automatically include a preprocessor definition for all Platform/Configuration combinations that can be used in a header to control exports/imports. For example, for a project named shared_lib VS2022 creates a preprocessor definition named SHAREDLIB_EXPORTS -

    sharedlib

    So if you change your code to use SHAREDLIB_EXPORTS instead of BUILD_MY_DLL the dll functions will be exported and an import library should be created.

    0 comments No comments