none
How to generate the lib using the res file? RRS feed

  • Question

  • Hi,

    I do the following things. Create a Manifest file called abcd.man by hand using a editor. Then I do

    mc -um abcd.man

    That will generate abcd.rc, abcd.h and 2 bin files

    Then I do rc.exe abcd.rc which will give me abcd.res file

    Then I do link.exe  /dll /noentry /machine:x64 abcd.res /OUT:abcd.dll

    That will get me abcd.dll. 

    Now I have a abcd.c program which has to be compiled to generate a abcd.exe. 

    This abcd.exe will dynamically load abcd.dll and work. However to build abcd.c I need abcd.lib to link during build. 

    So I did link.exe  /lib /machine:x64 abcd.res /OUT:abcd.lib

    I am using VS2017 and linking abcd.lib but VS2017 says the lib is bad. 

    Question1: What is the correct syntax to generate a lib using a res file in command line? 

    Question2: Suppose I generate the lib file successfully I would like to build the exe too on the command line. Then I don't have to worry about VS2017. Is this is the correct syntax

    cl.exe abcd.cs /lib=abcd.lib /OUT:abcd.exe??

    Question3: I have Googled a lot and had a feeling I can totally skip all the command line operation and just using abcd.man and abcd.c go to abcd.exe straight. That would be ideal. However I could not figure out how to embed abcd.man in VS2017. Wasted lot of time. If you can answer Q3 then Q1 and Q2 I really dont care. 

    Kindly advice. 

    Thanks in advance


    Saturday, February 9, 2019 2:11 AM

Answers

  • https://stackoverflow.com/questions/44030618/embedding-manifest-to-exe-file

    Finally I found the answer to my owes. Thanks to @Kundrata

    Step 1: mc.exe -um abcd.man

    That will generate the header file abcd.h. Then in VS2017 get abcd.c loaded as a project add the Manifest as below and it will work like a charm.

    ********************

    If your're using Visual Studio you don't need to build it explicitly, but there are 2 options which
    should be set beforehand:

    1) Project > Project_Name Properties > Configuration Properties > Linker > Manifest File -> Generate Manifest set to No

    2) Project > Project_Name Properties > Configuration Properties > Manifest Tool > Embed Manifest set to Yes

    Also add your manifest file to your project as existing item.

    ************************************

    If your're using Visual Studio you don't need to build it explicitly, but there are 2 options which should be set beforehand:

    1) Project > Project_Name Properties > Configuration Properties > Linker > Manifest File -> Generate Manifest set to No

    2) Project > Project_Name Properties > Configuration Properties > Manifest Tool > Embed Manifest set to Yes

    Also add your manifest file to your project as existing item.


    Saturday, February 9, 2019 5:49 PM

All replies

  • https://stackoverflow.com/questions/44030618/embedding-manifest-to-exe-file

    Finally I found the answer to my owes. Thanks to @Kundrata

    Step 1: mc.exe -um abcd.man

    That will generate the header file abcd.h. Then in VS2017 get abcd.c loaded as a project add the Manifest as below and it will work like a charm.

    ********************

    If your're using Visual Studio you don't need to build it explicitly, but there are 2 options which
    should be set beforehand:

    1) Project > Project_Name Properties > Configuration Properties > Linker > Manifest File -> Generate Manifest set to No

    2) Project > Project_Name Properties > Configuration Properties > Manifest Tool > Embed Manifest set to Yes

    Also add your manifest file to your project as existing item.

    ************************************

    If your're using Visual Studio you don't need to build it explicitly, but there are 2 options which should be set beforehand:

    1) Project > Project_Name Properties > Configuration Properties > Linker > Manifest File -> Generate Manifest set to No

    2) Project > Project_Name Properties > Configuration Properties > Manifest Tool > Embed Manifest set to Yes

    Also add your manifest file to your project as existing item.


    Saturday, February 9, 2019 5:49 PM
  • Thanks for sharing your solution here. 

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 22, 2019 5:34 AM
    Moderator