How to fix fatal error C1113: #using failed to execute 'Mylib.lib'

I have a project that uses C ++ / CLI to implement a GUI and some background processing to talk to a sensor. I have everything that works, and a lot of the materials that we use to communicate with the sensor are in the .dll. The problem is that I would like to merge the library into the main executable so as not to worry about the distribution of .dlls.

I have a demo project that works fine using .lib, but when I try to switch the body of the mani code to create .lib instead of .dll, I get the following error:

1>------ Build started: Project: MyTool, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>.\stdafx.cpp : fatal error C1113: #using failed on 'c:\projects\MyTool\debug\MyLib.lib'

A little googling suggests that this happens when you do not use the MSIL switch, but it is definitely located there in the library project.

I have mixed managed and unmanaged code both in my demo project and in reality, so I'm really trying to understand what the problem is.

Any suggestions would be greatly appreciated!

+3
source share
3 answers

I have a little guess, but I suspect that the MyTool project has the "MyLib" project as one of its "links" (menu "Project" → "Properties" → "General Properties →").

When you change the project type of MyLib to LIB instead of the DLL, you need to remove "MyLib" from the project links. Then you update the project dependencies from the solution (Project menu → Project Dependencies ...), so MyTool depends on MyLib.

+6
source

. , , , / ++ DLL .NET 4.0. DLL, , DLL.NET 2.0. , . . , DLL .NET 4.0. .NET.

0

DLL (/), . , CLR, . , , Project | Properties | Common Properties | References, .

0

Source: https://habr.com/ru/post/1730196/


All Articles