Ошибка lnk1181 не удается открыть входной файл

I’ve been encountering a strange bug in Visual Studio 2010 for some time now.

I have a solution consisting of a project which compiles to a static library, and another project which is really simple but depends on this library.

Sometimes, in the last days extremely frequent, after Rebuilding the Solution or just compiling it with 1-3 changed source files, I get the following error:

2>LINK : fatal error LNK1181: cannot open input file 'thelibrary.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

Where compiling thelibrary.lib was a success without any errors or warnings.

I have tried cleaning the solution, but that doesn’t always work.

  • What is wrong here?

BartoszKP's user avatar

BartoszKP

34.6k14 gold badges101 silver badges129 bronze badges

asked Jun 23, 2011 at 8:33

Komn's user avatar

2

In Linker, general, additional library directories, add the directory to the .dll or .libs you have included in Linker, Input.
It does not work if you put this in VC++ Directories, Library Directories.

answered Jun 25, 2012 at 2:19

Chris Thorne's user avatar

I can see only 1 things happening here:
You did’t set properly dependences to thelibrary.lib in your project meaning that thelibrary.lib is built in the wrong order (Or in the same time if you have more then 1 CPU build configuration, which can also explain randomness of the error). ( You can change the project dependences in: Menu->Project->Project Dependencies )

answered Jun 23, 2011 at 8:51

Sasha's user avatar

SashaSasha

8465 silver badges9 bronze badges

4

Go to:

Project properties -> Linker -> General -> Link Library Dependencies set No.

user's user avatar

user

86.9k18 gold badges197 silver badges190 bronze badges

answered May 29, 2012 at 11:50

EkaYuda's user avatar

EkaYudaEkaYuda

1371 silver badge4 bronze badges

2

I recently hit the same error. Some digging brought up this:
http://support.microsoft.com/kb/815645

Basically, if you have spaces in the path of the .lib, that’s bad. Don’t know if that’s what’s happening for you, but seems reasonably possible.

The fix is either 1) put the lib reference in «quotes», or 2) add the lib’s path to your Library Directories (Configuration Properties >> VC++ Directories).

answered Nov 11, 2011 at 13:05

Clippy's user avatar

ClippyClippy

3543 silver badges10 bronze badges

2

I had the same issue in both VS 2010 and VS 2012.
On my system the first static lib was built and then got immediately deleted when the main project started building.

The problem is the common intermediate folder for several projects. Just assign separate intermediate folder for each project.

Read more on this here

answered Sep 29, 2013 at 10:50

alexkr's user avatar

alexkralexkr

4,5801 gold badge24 silver badges21 bronze badges

2

I solved it with the following:

Go to View-> Property Pages -> Configuration Properties -> Linker -> Input

Under additional dependencies add the thelibrary.lib. Don’t use any quotations.

answered Feb 7, 2013 at 3:08

user2049230's user avatar

I had a similar problem in that I was getting LINK1181 errors on the .OBJ file that was part of the project itself (and there were only 2 .cxx files in the entire project).

Initially I had setup the project to generate an .EXE in Visual Studio, and then in the
Property Pages -> Configuration Properties -> General -> Project Defaults -> Configuration Type, I changed the .EXE to .DLL. Suspecting that somehow Visual Studio 2008 was getting confused, I recreated the entire solution from scratch using .DLL mode right from the start. Problem went away after that. I imagine if you manually picked your way through the .vcproj and other related files you could figure out how to fix things without starting from scratch (but my program consisted of two .cpp files so it was easier to start over).

Vikdor's user avatar

Vikdor

23.9k10 gold badges61 silver badges84 bronze badges

answered Oct 7, 2012 at 4:43

user1726157's user avatar

user1726157user1726157

2512 silver badges4 bronze badges

I’m stumbling into the same issue. For me it seems to be caused by having 2 projects with the same name, one depending on the other.

For example, I have one project named Foo which produces Foo.lib. I then have another project that’s also named Foo which produces Foo.exe and links in Foo.lib.

I watched the file activity w/ Process Monitor. What seems to be happening is Foo(lib) is built first—which is proper because Foo(exe) is marked as depending on Foo(lib). This is all fine and builds successfully, and is placed in the output directory—$(OutDir)$(TargetName)$(TargetExt). Then Foo(exe) is triggered to rebuild. Well, a rebuild is a clean followed by a build. It seems like the ‘clean’ stage of Foo.exe is deleting Foo.lib from the output directory. This also explains why a subsequent ‘build’ works—that doesn’t delete output files.

A bug in VS I guess.

Unfortunately I don’t have a solution to the problem as it involves Rebuild. A workaround is to manually issue Clean, and then Build.

answered Apr 25, 2013 at 5:26

Nick's user avatar

I don’t know why, but changing the Linker->Input->Additional Dependencies reference from «dxguid.lib» to «C:Program Files (x86)Microsoft DirectX SDK (June 2010)Libx86dxguid.lib» (in my case) was the only thing that worked.

answered Dec 3, 2013 at 7:56

Vic's user avatar

VicVic

4878 silver badges16 bronze badges

Maybe you have a hardware problem.

I had the same problem on my old system (AMD 1800 MHz CPU ,1GB RAM ,Windows 7 Ultimate) ,until I changed the 2x 512 MB RAM to 2x 1GB RAM. Haven’t had any problems since. Also other (minor) problems disappeared. Guess those two 512 MB modules didn’t like each other that much ,because 2x 512 MB + 1GB or 1x 512 MB + 2x 1GB didn’t work properly either.

answered Jun 24, 2011 at 8:09

engf-010's user avatar

engf-010engf-010

3,9801 gold badge14 silver badges25 bronze badges

For me the problem was a wrong include directory. I have no idea why this caused the error with the seemingly missing lib as the include directory only contains the header files. And the library directory had the correct path set.

answered Oct 17, 2014 at 12:54

mgttlinger's user avatar

mgttlingermgttlinger

1,4252 gold badges21 silver badges35 bronze badges

You can also fix the spaces-in-path problem by specifying the library path in DOS «8.3» format.

To get the 8.3 form, do (at the command line):

DIR /AD /X

recursively through every level of the directories.

answered Jun 4, 2016 at 22:15

Pierre's user avatar

PierrePierre

4,0742 gold badges34 silver badges39 bronze badges

I had the same problem. Solved it by defining a macro OBJECTS that contains all the linker objects e.g.:

OBJECTS = target.exe kernel32.lib mylib.lib (etc)

And then specifying $(OBJECTS) on the linker’s command line.

I don’t use Visual Studio though, just nmake and a .MAK file

0xdb's user avatar

0xdb

3,5291 gold badge19 silver badges36 bronze badges

answered Nov 4, 2017 at 16:47

Martin van Rijen's user avatar

I had the same error when running lib.exe from cmd on Windows with a long argument list. apparently cmd.exe has max line length of about 8K characters, which resulted that the filenames at the end of this threshold got changed, thus resulting in bad filename error.
my solution was to trim the line. I removed all paths from filenames and added single path using /LIBPATH option. for example:

/LIBPATH:absolute_path /OUT:outfilename filename1.obj filename2.obj ... filenameN.obj

answered Nov 1, 2018 at 14:31

Haim Itzhayek's user avatar

I found a different solution for this…

Actually, I missed comma separator between two library paths. After adding common it worked for me.

Go to: Project properties -> Linker -> General -> Link Library Dependencies
At this path make sure the path of the library is correct.

Previous Code (With Bug — because I forgot to separate two lib paths with comma):

<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

Code after fix (Just separate libraries with comma):

<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**;....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

Hope this will help you.

Ehsan Mohammadi's user avatar

answered May 8, 2019 at 11:32

Shubham's user avatar

In my case I had the library installed using NuGet package (cpprestsdk) AND I falsely added the lib to the Additional Dependancies in the Linker settings. It turns out, the package does it all for you.

The linker then tried to find the library in the library path and of course could not find it.

After removing the library from the Additional Dependencies everything compiled and linked fine.

answered May 10, 2019 at 11:35

Bojan Hrnkas's user avatar

Bojan HrnkasBojan Hrnkas

1,55816 silver badges22 bronze badges

Not quite the answer to OP’s question as I am using CMake with Visual Studio as a generator but I personally also just encountered the same issue (I am using Visual Studio toolchain, but not the IDE to build stuff).

My fix was target linking the directory of the directory of the libraries (I had a few) before target linking the library.

//Works
target_link_directories(MyExe PRIVATE /out/of/scope/path/to/lib)
foreach(X IN LISTS LIBSLISTNAMES)
    target_link_libraries(MyExe ${X})
endforeach()

//Throws cannot open cannot open input file error
 foreach(X IN LISTS LIBSLISTNAMES)
    target_link_libraries(MyExe /out/of/scope/path/to/lib/${X})
endforeach()

Not sure what is happening under the hood, but maybe VS IDE has equivalent setting somewhere?

answered Jun 17, 2021 at 0:36

Curious_Student's user avatar

I’ve also experienced this problem. For me the dependencies were properly set, but one of the projects in my solution wasn’t selected for building in the configuration (VS 2022 pro).

I eventually figured out thanks to output in Build -> Clean Solution that mentioned one of the project in dependency chain being disabled. Interesingly enough, when trying to build the disabled project it wouldd not properly build its dependencies.

answered Feb 14, 2022 at 15:14

Barnaba's user avatar

BarnabaBarnaba

6575 silver badges19 bronze badges

In the solution were two projects A and B. Building B requires A.lib, and somewhere along the line, the solution was cleaned.
Later, for testing purposes it was desired to build B alone, and the error was mistakenly taken as

cannot open input file ‘B.lib’

instead of what it actually was

cannot open input file ‘A.lib’

So burning the candles at both ends in order to comprehend why the project B build process would delete its own library!

answered Feb 23 at 5:21

Laurie Stearn's user avatar

Laurie StearnLaurie Stearn

9611 gold badge12 silver badges33 bronze badges

I created a bin directory at the project_dir level, then created a release/debug directory inside the bin folder, which solved the problem for me.

Matt's user avatar

Matt

74.1k26 gold badges153 silver badges180 bronze badges

answered Aug 19, 2013 at 17:11

Ravi Sohal's user avatar

У меня есть библиотека, которая использует Intel Composer XE 2013, и я хотел бы скомпилировать ее как .lib, так как собираюсь использовать ее с другим проектом (по умолчанию она компилируется как application / EXE). Тем не менее, когда я устанавливаю тип конфигурации в Project Defaults в Configuration Manager в Visual Studio 2012, я получаю сообщение об ошибке «LNK1181: не удается открыть входной файл». Странно, что файл, который он ищет, не имеет конца файла. Проект содержит как C, C ++, так и ASM-код. У кого-нибудь есть опыт с таким поведением?

2

Решение

Некоторые распространенные причины ошибки LNK1181:

  • имя файла указывается как дополнительная зависимость от компоновщика
    строка, но файл не существует.
  • Оператор A / LIBPATH, который определяет каталог, содержащий имя файла
    пропал, отсутствует.

Чтобы решить вышеуказанные проблемы, убедитесь, что все файлы, на которые есть ссылки в строке компоновщика, присутствуют в системе.

Используйте параметр / LIBPATH, чтобы переопределить путь к библиотеке среды. Компоновщик сначала выполняет поиск по пути, указанному в этом параметре, а затем выполняет поиск по пути, указанному в переменной среды LIB. Вы можете указать только один каталог для каждого параметра / LIBPATH, который вы вводите. Если вы хотите указать более одного каталога, вы должны указать несколько параметров / LIBPATH. Затем компоновщик будет искать в указанных каталогах по порядку.

Чтобы установить этот параметр компоновщика в среде разработки Visual Studio

  1. Откройте диалоговое окно страниц свойств проекта.
  2. Нажмите на папку Linker.
  3. Нажмите на страницу свойств General.
  4. Измените свойство «Дополнительные каталоги библиотек».

Если это не поможет, вы можете просмотреть эти ссылки:

  • Получение фатальной ошибки LNK1181: не удается открыть входной файл
  • Появляется сообщение об ошибке «Неустранимая ошибка LNK1181» при создании
    Управляемое приложение C ++
  • Visual Studio: ССЫЛКА: фатальная ошибка LNK1181: не удается открыть ввод
    файл

2

Другие решения

Я решил проблему, переименовав файлы .obj без их расширения. Например, он искал имя файла «foo», у меня был «foo.obj», поэтому я переименовал «foo.obj» в «foo».

0

Я уже некоторое время встречаю странную ошибку в Visual Studio 2010.

У меня есть решение, состоящее из проекта, который компилируется в статическую библиотеку, и другого проекта, который действительно прост, но зависит от этой библиотеки.

Иногда, в последние дни очень часто, после восстановления решения или просто компиляции его с 1-3 измененными исходными файлами, я получаю следующую ошибку:

2>LINK : fatal error LNK1181: cannot open input file 'thelibrary.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

Где компиляция thelibrary.lib имела успех без каких-либо ошибок или предупреждений.

Я пробовал очистить решение, но это не всегда работает.

  • Что здесь не так?

23 июнь 2011, в 10:42

Поделиться

Источник

14 ответов

В Linker, общие, дополнительные каталоги библиотек, добавьте каталог в DLL или .lib, которые вы включили в Linker, Input.
Это не работает, если вы поместите это в каталоги VС++, каталоги библиотек.

Chris Thorne
25 июнь 2012, в 03:43

Поделиться

Перейдите к:

Project properties -> Linker -> General -> Link Library Dependencies set No.

EkaYuda
29 май 2012, в 13:09

Поделиться

Я вижу только 1 вещи, происходящие здесь:
Вы не установили должным образом зависимости от thelibrary.lib в своем проекте, что означает, что thelibrary.lib построен в неправильном порядке (или в то же время, если у вас более 1 конфигурация сборки CPU, что также может объяснить случайность ошибки), (Вы можете изменить зависимости проекта в: Menu- > Project- > Project Dependencies)

Sasha
23 июнь 2011, в 09:45

Поделиться

Недавно я попал в ту же ошибку. Некоторое копание вызвало это:
http://support.microsoft.com/kb/815645

В принципе, если у вас есть пробелы на пути .lib, это плохо. Не знаю, что с тобой происходит, но кажется разумным.

Исправление: либо 1) поместить ссылку на lib в «кавычки», либо 2) добавить путь lib к вашим библиотечным каталогам (Свойства конфигурации → Каталоги VС++).

Clippy
11 нояб. 2011, в 13:35

Поделиться

У меня была такая же проблема как в VS 2010, так и в VS 2012.
В моей системе была создана первая статическая библиотека, а затем сразу же удалена при запуске основного проекта.

Проблема заключается в общей промежуточной папке для нескольких проектов. Просто назначьте отдельную промежуточную папку для каждого проекта.

Подробнее об этом здесь

alexkr
29 сен. 2013, в 12:46

Поделиться

Я решил это со следующим:

Перейдите в View- > Страницы свойств → Свойства конфигурации → Коннектор → Вход

В дополнительных зависимостях добавьте thelibrary.lib. Не используйте никаких цитат.

user2049230
07 фев. 2013, в 04:52

Поделиться

У меня была аналогичная проблема, так как я получал ошибки LINK1181 в файле .OBJ, который был частью самого проекта (и во всем проекте было всего 2 файла .cxx).

Сначала я установил проект для создания .EXE в Visual Studio, а затем в
Property Pages -> Configuration Properties -> General -> Project Defaults -> Configuration Type, я изменил .EXE на .DLL. Подозревая, что Visual Studio 2008 каким-то образом запуталась, я с самого начала воссоздал все решение с нуля с использованием режима .DLL. После этого проблема исчезла. Я предполагаю, что если вы вручную проведете свой путь через .vcproj и другие связанные файлы, вы сможете выяснить, как исправить ситуацию, не начиная с нуля (но моя программа состояла из двух файлов .cpp, поэтому было легче начать все заново).

user1726157
07 окт. 2012, в 05:29

Поделиться

Для меня проблема была неправильной директорией include. Я понятия не имею, почему это вызвало ошибку с, казалось бы, отсутствующей библиотекой lib, поскольку каталог include содержит только заголовочные файлы. И каталог библиотеки имел правильный набор путей.

mgttlinger
17 окт. 2014, в 13:43

Поделиться

Я не знаю почему, но изменив ссылку Linker- > Input- > Additional Dependencies из «dxguid.lib» на «C:Program Files (x86)Microsoft DirectX SDK (июнь 2010)Libx86dxguid.lib» (в моем случае) — единственное, что сработало.

Vic
03 дек. 2013, в 08:06

Поделиться

Я сталкиваюсь с тем же вопросом. Для меня это, по-видимому, вызвано наличием двух проектов с тем же именем, один из которых зависит от другого.

Например, у меня есть один проект с именем Foo, который создает Foo.lib. Затем у меня есть еще один проект, который также называется Foo, который создает Foo.exe и ссылки в Foo.lib.

Я просмотрел файловую активность с Монитором процессов. Похоже, что Foo (lib) создается первым — что является правильным, потому что Foo (exe) помечен как зависящий от Foo (lib). Все это прекрасно и успешно строится и помещается в выходной каталог — $(OutDir) $(TargetName) $(TargetExt). Затем Foo (exe) запускается для восстановления. Ну, перестройка — это чистый, за которым следует сборка. Похоже, что «чистый» этап Foo.exe удаляет Foo.lib из выходного каталога. Это также объясняет, почему работает последующая «сборка», которая не удаляет выходные файлы.

Ошибка в VS, я думаю.

К сожалению, у меня нет решения проблемы, так как она включает Rebuild. Обходной путь заключается в том, чтобы вручную очистить Clean, а затем Build.

Nick
25 апр. 2013, в 06:14

Поделиться

У меня была та же проблема. Решил его, указав макрос OBJECTS, содержащий все объекты компоновщика, например:

OBJECTS = target.exe kernel32.lib mylib.lib (etc)

И затем укажите $(OBJECTS) в командной строке компоновщика.

Я не использую Visual Studio, хотя, просто nmake и .MAK файл

Martin van Rijen
04 нояб. 2017, в 18:39

Поделиться

Вы также можете исправить проблему пробела в пути, указав путь библиотеки в формате DOS «8.3».

Чтобы получить форму 8.3, выполните (в командной строке):

DIR /AD /X

рекурсивно через каждый уровень каталогов.

Pierre
04 июнь 2016, в 23:16

Поделиться

Возможно, у вас есть проблемы с оборудованием.

У меня была такая же проблема на моей старой системе (процессор AMD 1800 МГц, 1 ГБ оперативной памяти, Windows 7 Ultimate), пока я не изменил 2x 512 МБ ОЗУ на 2x 1 ГБ ОЗУ. С тех пор не было никаких проблем. Также исчезли другие (второстепенные) проблемы. Угадайте, что эти два модуля объемом 512 МБ не очень понравились друг другу, потому что 2x 512 МБ + 1 ГБ или 1x 512 МБ + 2x 1 ГБ тоже не работали.

engf-010
24 июнь 2011, в 09:03

Поделиться

Я создал каталог bin на уровне project_dir, а затем создал каталог release/debug внутри папки bin, который решил проблему для меня.

Ravi Sohal
19 авг. 2013, в 17:48

Поделиться

Ещё вопросы

  • 0Удаление опций из Выбрать с помощью Jquery
  • 1Python создает столбец на основе того, является ли строка подстрокой в панде Dataframe
  • 0Javascript не работает после загрузки сервера
  • 1Реактивный род-андроид застрял с белым дисплеем на симуляторе андроид-студии с надписью «Загрузка из 10.0.2.2.8081»
  • 1подсчитать количество тегов в документе couchdb
  • 1Передача коллекции абстрактного класса в качестве параметра в функцию
  • 1Плавное вращение камеры (look-control) в A-Frame
  • 1Программа NullPointerException LifeGame.java
  • 0Один пользователь несколько адресов доставки, как сделать это по умолчанию
  • 0MySQL меняет уникальный ключ на основной (mariadb)
  • 1Как открыть разговор в WhatsApp на определенный номер с намерением
  • 0MySQL выбирает одно значение из таблицы, если есть два языка [дубликата]
  • 0PHP Array_combine неопределенный индекс
  • 0Hibernate выберите после вставки
  • 0Добавить дополнительные btn-group onclick
  • 1BitArray И операция
  • 1Бинарный поиск дает неверный вывод Java
  • 1Android Kotlin — пойманное исключение, по-прежнему вылетает программа
  • 0Размер сайта резко меняется в браузере
  • 0Нужна функция для запуска при выборе опции в выпадающем списке
  • 1Почему рендеринг textField с поведением занимает так много времени
  • 1Как добавить дополнительный исходный каталог для maven для использования только при выполнении тестов или при отладке?
  • 1Разобрать данные и представить изображение PNG
  • 1Понимание методов. Java-код
  • 0использовать DGEMM BLAS в Windows Eclipse
  • 1Конвертировать декоратор в пользовательский виджет в DOJO?
  • 1Метод .split () в Java не найден
  • 1Изменение целевого фреймворка в приложении Xamarin.forms с Android 8.1 на Android 9 (для Xamarin.Essentials)
  • 1Маршрутизатор не определен Node.js
  • 1TargetInvocationException при запуске проекта на wp7
  • 1Плохо разработанное приложение: мы должны переписать?
  • 0Как отобразить поле в корзине с информацией о сумке, в которую был брошен товар, с помощью jquery
  • 0JQuery выбрать конкретную группу и удалить параметры
  • 0Сортировка JSON данных на стороне клиента
  • 0Наложение CSS не работает
  • 1Чтение определенного элемента XML
  • 0только atoi возвращает первую цифру параметра char * [duplicate]
  • 0Очистить разметку AngularJs
  • 0ссылки в tinyMce
  • 0C ++ MFC RegEx выпуск
  • 1Вызов await () для функций приостановки работает неправильно
  • 0Получить измененные поля
  • 0Установка состояния в 0, если флажки не установлены
  • 0$ http.post, приводящий к ошибке OPTIONS 596 или недостаточным аргументам
  • 0Как добавить значение в пользовательский атрибут с помощью JQuery?
  • 0Запрос PDO Связывание таблиц и отображение результатов
  • 0Дополнительное пространство под нижним колонтитулом
  • 0Может ли контроллер модального окна работать в родительском контроллере?
  • 0Функция, использующая класс в качестве параметра [closed]
  • 0Как получить все данные из таблицы, которую вы также запрашиваете для AVG

Сообщество Overcoder

Перейти к контенту

I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default). However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get » error LNK1181: cannot open input file» Odd part is that the file it looks for has no file ending. The project contains both C, C++ and ASM code. Does anyone got any experience with this kind of behavior?

asked Jul 10, 2013 at 22:17

Martin's user avatar

2

Some common causes for error LNK1181 are:

  • filename is referenced as an additional dependency on the linker
    line, but the file does not exist.
  • A /LIBPATH statement that specifies the directory containing filename
    is missing.

To resolve the above issues, ensure any files referenced on the linker line are present on the system.

Use the /LIBPATH option to override the environment library path. The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable. You can specify only one directory for each /LIBPATH option you enter. If you want to specify more than one directory, you must specify multiple /LIBPATH options. The linker will then search the specified directories in order.

To set this linker option in the Visual Studio development environment

  1. Open the project’s Property Pages dialog box.
  2. Click the Linker folder.
  3. Click the General property page.
  4. Modify the Additional Library Directories property.

If that doesn’t help then you can look through these links :

  • Getting fatal error LNK1181: cannot open input file
  • You receive a «fatal error LNK1181» error message when you build a
    Managed C++ application
  • Visual Studio: LINK : fatal error LNK1181: cannot open input
    file

mirh's user avatar

mirh

4767 silver badges14 bronze badges

answered Jul 11, 2013 at 1:23

0decimal0's user avatar

0decimal00decimal0

3,8862 gold badges23 silver badges39 bronze badges

2

I solved the issue by renaming the .obj files without their file extension. For example, it was looking for file name «foo», I had «foo.obj» so I renamed «foo.obj» to «foo».

answered Jul 14, 2013 at 13:07

Martin's user avatar

MartinMartin

2,4664 gold badges24 silver badges36 bronze badges

0

I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default). However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get » error LNK1181: cannot open input file» Odd part is that the file it looks for has no file ending. The project contains both C, C++ and ASM code. Does anyone got any experience with this kind of behavior?

asked Jul 10, 2013 at 22:17

Martin's user avatar

2

Some common causes for error LNK1181 are:

  • filename is referenced as an additional dependency on the linker
    line, but the file does not exist.
  • A /LIBPATH statement that specifies the directory containing filename
    is missing.

To resolve the above issues, ensure any files referenced on the linker line are present on the system.

Use the /LIBPATH option to override the environment library path. The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable. You can specify only one directory for each /LIBPATH option you enter. If you want to specify more than one directory, you must specify multiple /LIBPATH options. The linker will then search the specified directories in order.

To set this linker option in the Visual Studio development environment

  1. Open the project’s Property Pages dialog box.
  2. Click the Linker folder.
  3. Click the General property page.
  4. Modify the Additional Library Directories property.

If that doesn’t help then you can look through these links :

  • Getting fatal error LNK1181: cannot open input file
  • You receive a «fatal error LNK1181» error message when you build a
    Managed C++ application
  • Visual Studio: LINK : fatal error LNK1181: cannot open input
    file

mirh's user avatar

mirh

4767 silver badges14 bronze badges

answered Jul 11, 2013 at 1:23

0decimal0's user avatar

0decimal00decimal0

3,8862 gold badges23 silver badges39 bronze badges

2

I solved the issue by renaming the .obj files without their file extension. For example, it was looking for file name «foo», I had «foo.obj» so I renamed «foo.obj» to «foo».

answered Jul 14, 2013 at 13:07

Martin's user avatar

MartinMartin

2,4664 gold badges24 silver badges36 bronze badges

0

I’ve been encountering a strange bug in Visual Studio 2010 for some time now.

I have a solution consisting of a project which compiles to a static library, and another project which is really simple but depends on this library.

Sometimes, in the last days extremely frequent, after Rebuilding the Solution or just compiling it with 1-3 changed source files, I get the following error:

2>LINK : fatal error LNK1181: cannot open input file 'thelibrary.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

Where compiling thelibrary.lib was a success without any errors or warnings.

I have tried cleaning the solution, but that doesn’t always work.

  • What is wrong here?

BartoszKP's user avatar

BartoszKP

34.2k14 gold badges104 silver badges129 bronze badges

asked Jun 23, 2011 at 8:33

Komn's user avatar

2

In Linker, general, additional library directories, add the directory to the .dll or .libs you have included in Linker, Input.
It does not work if you put this in VC++ Directories, Library Directories.

answered Jun 25, 2012 at 2:19

Chris Thorne's user avatar

I can see only 1 things happening here:
You did’t set properly dependences to thelibrary.lib in your project meaning that thelibrary.lib is built in the wrong order (Or in the same time if you have more then 1 CPU build configuration, which can also explain randomness of the error). ( You can change the project dependences in: Menu->Project->Project Dependencies )

answered Jun 23, 2011 at 8:51

Sasha's user avatar

SashaSasha

8365 silver badges9 bronze badges

4

Go to:

Project properties -> Linker -> General -> Link Library Dependencies set No.

user's user avatar

user

86.7k18 gold badges198 silver badges190 bronze badges

answered May 29, 2012 at 11:50

EkaYuda's user avatar

EkaYudaEkaYuda

1271 silver badge4 bronze badges

1

I recently hit the same error. Some digging brought up this:
http://support.microsoft.com/kb/815645

Basically, if you have spaces in the path of the .lib, that’s bad. Don’t know if that’s what’s happening for you, but seems reasonably possible.

The fix is either 1) put the lib reference in «quotes», or 2) add the lib’s path to your Library Directories (Configuration Properties >> VC++ Directories).

answered Nov 11, 2011 at 13:05

Clippy's user avatar

ClippyClippy

3543 silver badges10 bronze badges

2

I had the same issue in both VS 2010 and VS 2012.
On my system the first static lib was built and then got immediately deleted when the main project started building.

The problem is the common intermediate folder for several projects. Just assign separate intermediate folder for each project.

Read more on this here

answered Sep 29, 2013 at 10:50

alexkr's user avatar

alexkralexkr

4,5641 gold badge23 silver badges21 bronze badges

1

I solved it with the following:

Go to View-> Property Pages -> Configuration Properties -> Linker -> Input

Under additional dependencies add the thelibrary.lib. Don’t use any quotations.

answered Feb 7, 2013 at 3:08

user2049230's user avatar

I had a similar problem in that I was getting LINK1181 errors on the .OBJ file that was part of the project itself (and there were only 2 .cxx files in the entire project).

Initially I had setup the project to generate an .EXE in Visual Studio, and then in the
Property Pages -> Configuration Properties -> General -> Project Defaults -> Configuration Type, I changed the .EXE to .DLL. Suspecting that somehow Visual Studio 2008 was getting confused, I recreated the entire solution from scratch using .DLL mode right from the start. Problem went away after that. I imagine if you manually picked your way through the .vcproj and other related files you could figure out how to fix things without starting from scratch (but my program consisted of two .cpp files so it was easier to start over).

Vikdor's user avatar

Vikdor

23.8k10 gold badges61 silver badges83 bronze badges

answered Oct 7, 2012 at 4:43

user1726157's user avatar

user1726157user1726157

2512 silver badges4 bronze badges

I’m stumbling into the same issue. For me it seems to be caused by having 2 projects with the same name, one depending on the other.

For example, I have one project named Foo which produces Foo.lib. I then have another project that’s also named Foo which produces Foo.exe and links in Foo.lib.

I watched the file activity w/ Process Monitor. What seems to be happening is Foo(lib) is built first—which is proper because Foo(exe) is marked as depending on Foo(lib). This is all fine and builds successfully, and is placed in the output directory—$(OutDir)$(TargetName)$(TargetExt). Then Foo(exe) is triggered to rebuild. Well, a rebuild is a clean followed by a build. It seems like the ‘clean’ stage of Foo.exe is deleting Foo.lib from the output directory. This also explains why a subsequent ‘build’ works—that doesn’t delete output files.

A bug in VS I guess.

Unfortunately I don’t have a solution to the problem as it involves Rebuild. A workaround is to manually issue Clean, and then Build.

answered Apr 25, 2013 at 5:26

Nick's user avatar

I don’t know why, but changing the Linker->Input->Additional Dependencies reference from «dxguid.lib» to «C:Program Files (x86)Microsoft DirectX SDK (June 2010)Libx86dxguid.lib» (in my case) was the only thing that worked.

answered Dec 3, 2013 at 7:56

Vic's user avatar

VicVic

4586 silver badges14 bronze badges

Maybe you have a hardware problem.

I had the same problem on my old system (AMD 1800 MHz CPU ,1GB RAM ,Windows 7 Ultimate) ,until I changed the 2x 512 MB RAM to 2x 1GB RAM. Haven’t had any problems since. Also other (minor) problems disappeared. Guess those two 512 MB modules didn’t like each other that much ,because 2x 512 MB + 1GB or 1x 512 MB + 2x 1GB didn’t work properly either.

answered Jun 24, 2011 at 8:09

engf-010's user avatar

engf-010engf-010

3,9741 gold badge14 silver badges25 bronze badges

For me the problem was a wrong include directory. I have no idea why this caused the error with the seemingly missing lib as the include directory only contains the header files. And the library directory had the correct path set.

answered Oct 17, 2014 at 12:54

mgttlinger's user avatar

mgttlingermgttlinger

1,4152 gold badges21 silver badges35 bronze badges

You can also fix the spaces-in-path problem by specifying the library path in DOS «8.3» format.

To get the 8.3 form, do (at the command line):

DIR /AD /X

recursively through every level of the directories.

answered Jun 4, 2016 at 22:15

Pierre's user avatar

PierrePierre

3,9542 gold badges33 silver badges39 bronze badges

I had the same problem. Solved it by defining a macro OBJECTS that contains all the linker objects e.g.:

OBJECTS = target.exe kernel32.lib mylib.lib (etc)

And then specifying $(OBJECTS) on the linker’s command line.

I don’t use Visual Studio though, just nmake and a .MAK file

0xdb's user avatar

0xdb

3,4741 gold badge19 silver badges36 bronze badges

answered Nov 4, 2017 at 16:47

Martin van Rijen's user avatar

I had the same error when running lib.exe from cmd on Windows with a long argument list. apparently cmd.exe has max line length of about 8K characters, which resulted that the filenames at the end of this threshold got changed, thus resulting in bad filename error.
my solution was to trim the line. I removed all paths from filenames and added single path using /LIBPATH option. for example:

/LIBPATH:absolute_path /OUT:outfilename filename1.obj filename2.obj ... filenameN.obj

answered Nov 1, 2018 at 14:31

Haim Itzhayek's user avatar

I found a different solution for this…

Actually, I missed comma separator between two library paths. After adding common it worked for me.

Go to: Project properties -> Linker -> General -> Link Library Dependencies
At this path make sure the path of the library is correct.

Previous Code (With Bug — because I forgot to separate two lib paths with comma):

<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

Code after fix (Just separate libraries with comma):

<Link><AdditionalLibraryDirectories>....Buildlib$(Configuration)**;....BuildRelease;**%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

Hope this will help you.

Ehsan Mohammadi's user avatar

answered May 8, 2019 at 11:32

Shubham's user avatar

In my case I had the library installed using NuGet package (cpprestsdk) AND I falsely added the lib to the Additional Dependancies in the Linker settings. It turns out, the package does it all for you.

The linker then tried to find the library in the library path and of course could not find it.

After removing the library from the Additional Dependencies everything compiled and linked fine.

answered May 10, 2019 at 11:35

Bojan Hrnkas's user avatar

Bojan HrnkasBojan Hrnkas

1,53816 silver badges22 bronze badges

Not quite the answer to OP’s question as I am using CMake with Visual Studio as a generator but I personally also just encountered the same issue (I am using Visual Studio toolchain, but not the IDE to build stuff).

My fix was target linking the directory of the directory of the libraries (I had a few) before target linking the library.

//Works
target_link_directories(MyExe PRIVATE /out/of/scope/path/to/lib)
foreach(X IN LISTS LIBSLISTNAMES)
    target_link_libraries(MyExe ${X})
endforeach()

//Throws cannot open cannot open input file error
 foreach(X IN LISTS LIBSLISTNAMES)
    target_link_libraries(MyExe /out/of/scope/path/to/lib/${X})
endforeach()

Not sure what is happening under the hood, but maybe VS IDE has equivalent setting somewhere?

answered Jun 17, 2021 at 0:36

Curious_Student's user avatar

I’ve also experienced this problem. For me the dependencies were properly set, but one of the projects in my solution wasn’t selected for building in the configuration (VS 2022 pro).

I eventually figured out thanks to output in Build -> Clean Solution that mentioned one of the project in dependency chain being disabled. Interesingly enough, when trying to build the disabled project it wouldd not properly build its dependencies.

answered Feb 14, 2022 at 15:14

Barnaba's user avatar

BarnabaBarnaba

6475 silver badges19 bronze badges

I created a bin directory at the project_dir level, then created a release/debug directory inside the bin folder, which solved the problem for me.

Matt's user avatar

Matt

73.6k26 gold badges151 silver badges180 bronze badges

answered Aug 19, 2013 at 17:11

Ravi Sohal's user avatar

  • Remove From My Forums
  • Question

  • I compiled my program after doing all those settings in «Project Setting Menu»
    but i got an error :

    fatal error LNK1181: cannot open input file «,.obj»

    I think there is some problem in the settings. I checked all the settings tht i know but still not able to remove this error.

    If anyone know about the settings in VC++ then plz reply
    any help will be of great use
    Thanks in advance

Answers

  •  belikekhushi wrote:

    I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file

    Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..

    I think the libraries files have to be separated with a single space. If path contains a space, then use quotation marks.

    Otherwise «;» and «,» are treated as file names with «.obj» default extension.

    Hope it helps.

  • Check you linker settings. Did you placed a comma into one of those fields? Separate entries with a semicolon.

  • Sorry! I have no idea.

    I even can not see that there is a part like this in the command line.

    Try to create a new project from scratch.

All replies

  • Check you linker settings. Did you placed a comma into one of those fields? Separate entries with a semicolon.

  • I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file

    Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..

    Plz help me out…

  • What did you entered in you linker settings.

  • I tried following two:

    First time i tried this one :

    «E:MSDev98MyProjectsDCMConverterpngDebugpng.lib» ; «E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib» ; «E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib» ; «E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib» ; «E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib»

    and second time i tried this one:

    E:MSDev98MyProjectsDCMConverterpngDebugpng.lib ; E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib ; E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib ; E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib ; E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib

    In both cases i m getting the same error msg

    Linking…
    LINK : fatal error LNK1104: cannot open file «;.obj»
    Error executing link.exe.

  • Look into the build log, what is the command line for the build process.

  • I am sending you the command line of build log

    I am new to VC++ so, Its difficult for me to find error in this log.

    Build Log

    --------------------Configuration: DCMConverter - Win32 Debug--------------------

    Command Lines

    Creating temporary file "C:DOCUME~1ADMINI~1LOCALS~1TempRSP10B.tmp" with contents [ E:MSDev98MyProjectsDCMConverterpngDebugpng.lib ; E:MSDev98MyProjectsDCMConverterjpegDebugjpeg.lib ; E:MSDev98MyProjectsDCMConverterzlibDebugzlib.lib ; E:MSDev98MyProjectsDCMConvertertiffDebugtiff.lib ; E:MSDev98MyProjectsDCMConvertercximageDebugcximage.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/DCMConverter.pdb" /debug /machine:I386 /nodefaultlib:"msvcprtd.lib" /nodefaultlib:"msvcrtd.lib" /nodefaultlib:"msvcrt.lib" /out:"Release/DCMConverter.exe" /pdbtype:sept /libpath:"D:cximage599c_fullCxImageCxImageDLLDebug" /libpath:"D:dcmtkdcmtk-3.5.3Debug" /libpath:"D:dcmtkconfiginclude" /libpath:"D:dcmtkdcmjpeginclude" /libpath:"D:dcmtkofstdinclude" /libpath:"D:dcmtkdcmdatainclude" /libpath:"D:dcmtkdcmimgleinclude" /libpath:"D:dcmtkdcmimageinclude" /libpath:"D:dcmtkdcmjpeglibijg8" /libpath:"D:dcmtkdcmjpeglibijg12" /libpath:"D:dcmtkdcmjpeglibijg16" /libpath:"D:dcmtkzlib-1.2.1" /libpath:"D:dcmtktiff-v3.6.1libtiff" /libpath:"D:dcmtklibpng-1.2.5" .DebugDCMConverter.obj .DebugDCMConverterDlg.obj .DebugStdAfx.obj .DebugxImageDCM.obj .DebugDCMConverter.res ] Creating command line "link.exe @C:DOCUME~1ADMINI~1LOCALS~1TempRSP10B.tmp"

    Output Window

    Linking... LINK : fatal error LNK1104: cannot open file ";.obj" Error executing link.exe.

    Results

    DCMConverter.exe - 1 error(s), 0 warning(s)
  • Sorry! I have no idea.

    I even can not see that there is a part like this in the command line.

    Try to create a new project from scratch.

  • As Martin suggested, try creating project from scratch and see if the issue still reproduces.

    Thanks,
    Ayman Shoukry
    VC++ Team
  • hello

     i’am a new member; please will tell me if you have already found a solution for this problem , because i have the same problem, please it’s very urgent for me :

    the message is:

    Linking…

    LINK : fatal error LNK1181: cannot open input file ‘.DebugAssemblyInfo.obj’

    thanks a lot

  • Please create a new thread.

    Check your linker settings as I wrot ein this thread. Do you have an module named AssemblyInfo?

  • thanks for your answer

    i have a module named AssemblyInfo, but my programm don’t generate AssemblyInfo.obj .

    I don’t know what to change in linker settings will you help me please!

  • What kind of project is this? Managed C++/CLI?

    What did you added to the project, what source files you have?

  • it’s C++, with a dll main. a added sources that i had in visual studio C++ , and now i want to have them in visual studio .Net

    did you think that i should change liker settings ?

  • hello

     i’am a new member; please will tell me if you have already found a solution for this problem , because i have the same problem, please it’s very urgent for me :

    the message is:

    Linking…

    LINK : fatal error LNK1181: cannot open input file ‘.DebugAssemblyInfo.obj’

    thanks a lot

  • Whats in your linker settings?

  •  belikekhushi wrote:

    I checked my linker settings.. Earlier i was using comma to seperate entries sso in was getting error with «,.obj» input file

    Now, i replaced comma with semi-colon and now i am getting same error with «;.obj» file..

    I think the libraries files have to be separated with a single space. If path contains a space, then use quotation marks.

    Otherwise «;» and «,» are treated as file names with «.obj» default extension.

    Hope it helps.

  • hi,

    sorry, if i m late in replying that query.

    i am not very good at vc++ but yes i have two options to go for ur problem:

    first, go to the linker settings give their full path (like D;test……) and not the relative one…

    then build ur code again and then execute…

    if this helps thn its ok otherwise delete this «.DebugAssemblyInfo.obj» entry from the linker settings and then build the whole project again…

    hope one of these may help you…

  • I confirm, after a lot of try i find that the libraries files have to be separated with a single space.

  • Hello ,

    I have the same problem, using Visual studio 2008, but i really don’t understand what are the indications! How can I change the linker settings?

    When i look into the Linker…it has many submodules, like Generate, Input….and in the end: Command line, which has the following:

    /OUT:»C:Documents and SettingssimonaMy DocumentsVisual Studio 2008Projects1Debug1.exe» /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:»Debug1.exe.intermediate.manifest» /MANIFESTUAC:»level=’asInvoker’ uiAccess=’false’» /DEBUG /PDB:»C:Documents and SettingssimonaMy DocumentsVisual Studio 2008Projects1Debug1.pdb» /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

    I just wrote a simple Hello world program. I get this error all the time(also in Visual Studio 2005 and Visual Studio 2008):

    Error    1    fatal error LNK1104: cannot open file ‘.Debugmain.obj’    2    2

    Where main is the simple hello world program, whether it’s C++ or C. I tried reinstalling many times. No luck.

    Help , please??

    Thanks

  • Try resetting all your settings from whithin IDE.
    to do so under tool menu click import and export settings then click reset all.

    give it a try.

    regards

    Adi


    A K

  • I have encounterd the same problem,but I can’t find linker in project settings,instead I find library,how can I solve the problem?

  • I ran into a similar problem on Visual Studio 2017.

    The error was indeed cryptic. I got it to work by realizing that I forgot to include some external cpp files that needed to be compiled and built with my project.

    For those of you who run into the problem and found this thread, check and make sure that you haven’t forgot to include:

    1. External .cpp files
    2. That in your Linker –> Input –> Additional Dependencies settings, there’s no blank library like «.» or «$(INHERIT)»

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
.386
.MODEL FLAT, STDCALL
 
WM_DESTROY      equ 2
WM_CREATE       equ 1
WM_LBUTTONDOWN  equ 201h
WM_RBUTTONDOWN  equ 204h
CS_VREDRAW      equ 1h
CS_HREDRAW      equ 2h
CS_GLOBALCLASS                equ 4000h
WS_OVERLAPPEDWINDOW equ 000CF0000h
style equ CS_HREDRAW+CS_VREDRAW+CS_GLOBALCLASS
IDI_APPLICATION   equ 32512
IDC_CROWNORMAL   equ 1
 
EXTERN MesageBox@16:NEAR
EXTERN CreateWindowExA@48:NEAR
EXTERN DispatchMessageA@4:NEAR
EXTERN ExitProcess@4:NEAR
EXTERN GetMessageA@16:NEAR
EXTERN GetModuleA@4:NEAR
EXTERN LoadCursorA@8:NEAR
EXTERN LoadIconA@8:NEAR
EXTERN PostQuitMessage@4:NEAR
EXTERN ReqisterClassA@4:NEAR
EXTERN ShowWindow@8:NEAR
EXTERN TranslateMessage@4:NEAR
EXTERN UpdateWindow@4:NEAR
    
includelib C:masm32libuser32.lib
includelib C:masm32libkerne132.lib
 
MSGSTRUCT STRUC
    MSHWND      DD ?
    MSMESSAGE   DD ?
    MSWPARAM    DD ?
    MSLPARAM    DD ?
    MSTIME      DD ?
    MSPT        DD ?
MSGSTRUCT ENDS
;----------
WNDCLASS STRUC
    CLSSTYLE    DD ?
    CLWNDPROC   DD ?
    CLSCEXTRA   DD ?
    CLWNDEXTRA  DD ?
    CLSHINSTANCE    DD ?
    CLSHICON    DD ?
    CLSHCURSOR  DD ?
    CLBKGROUND  DD ?
    CLMENUNAME  DD ?
    CLNAME      DD ?
WNDCLASS ENDS
 
_DATA SEGMENT DWORD PUBLIC USE32 'DATA'
    NEWHWND DD 0
    MSG MSGSTRUCT <?>
    WC  WNDCLASS  <?>
    HINST   DD 0
    TITLENAME DB 'PERSHA PROGRAMA',0
    CLASSNAME DB 'CLASS',0
    CAP     DB 'Message', 0
    MES1        DB 'YOUR PUSH LEFT BUTTON', 0
    MES2        DB 'EXIT', 0 
_DATA ENDS
 
_TEXT SEGMENT DWORD PUBLIC USE32 'CODE'
    START:
    PUSH 0
    CALL GetModuleHandleA@4
    MOV [HINST], EAX
 
REG_CLASS:
    MOV [WC.CLSSTYLE], style
    MOV [WC.CLWNDPROC], OFFSET WNDPROC
    MOV [WC.CLSCEXTRA] , 0
    MOV [WC.CLWNDEXTRA] , 0
    MOV EAX, [HINST]
    MOV [WC.CLSHINSTANCE] , EAX
    PUSH IDI_APPLICATION
    PUSH 0
    CALL LoadIconA@8
        MOV [WC.CLSHICON] , EAX
        PUSH IDC_CROSS
        PUSH 0
        CALL LoadCursorA@8
    MOV [WC.CLSHCURSOR], EAX
              MOV [WC.CLBKGROUND], 17
              MOV DWORD PTR [WC.CLMENUNAME], 0
                 MOV DWORD PTR [WC.CLNAME], OFFSET CLASSNAME
              PUSH OFFSET WC
              CALL RegisterClassA@4
              PUSH 0
              PUSH [HINST]
              PUSH 0
              PUSH 0
              PUSH 400
              PUSH 400
              PUSH 100
              PUSH 100
              PUSH WS_OVERLAPPEDWINDOW
              PUSH OFFSET TITLENAME
              PUSH OFFSET CLASSNAME
              PUSH 0
              CALL CreateWindowExA@48
              CMP EAX, 0
              JZ  _ERR
              MOV [NEWHWND], EAX
              PUSH SW_SHOWNORMAL
              PUSH [NEWHWND]
              CALL ShowWindow@8
              PUSH [NEWHWND]
              CALL UpdateWindow@4
 
     MSG_LOOP:
              PUSH 0
              PUSH 0
              PUSH 0
              PUSH OFFSET MSG
              CALL GetMessageA@16
              CMP EAX, 0
              JE END_LOOP
              PUSH OFFSET MSG
              CALL TranslateMessage@4
              PUSH OFFSET MSG
              CALL DispatchMessageA@4
              JMP MSG_LOOP
 
     END_LOOP:
             PUSH [MSG.MSWPARAM]
             CALL ExitProcess@4
    _ERR:
              JMP END_LOOP
 
   WINDPROC PROC
            PUSH            EBP
            MOV             EBP, ESP
            PUSH            EBX
            PUSH            ESI
            PUSH            EDI
            CMP              DWORD PTR[EBP+0CH], WM_DESTROY
            JE                       WMDESTROY
            CMP              DWORD PTR[EBR+0CH], WM_CREATE
            JE                        WMCREATE
            CMP              DWORD PTR[EBR+0CH], WM_LBUTTONDOWN
            JE                       LBUTTON
            CMP              DWORD PRT[[EBR+0CH], WM_RBUTTONDOWN
            JE                       RBUTTON
            JMP               DEFWNDPROC
 
     RBUTTON:
             JMP   WMDESTROY
LBUTTON:
    PUSH 0
    PUSH OFFSET CAP
    PUSH OFFSET MES1
    PUSH DWORD PTR [EBP+08H]
    CALL MessageBoxA@16
    MOV EAX, 0 
    JMP FINISH
WMCREATE:
    MOV EAX, 0
    JMP FINISH
DEFWNDPROC:
    PUSH DWORD PTR[EBP+14H]
    PUSH DWORD PTR[EBP+10H]
    PUSH DWORD PTR[EBP+0CH]
    PUSH DWORD PTR[EBP+08H]
    CALL DefWindowProcA@16
    JMP FINISH
WMDESTROY:
PUSH 0
PUSH OFFSET CAP
PUSH OFFSET MES2
PUSH DWORD PRT[EBP+08H] ; 
CALL MessageBoxA@16
PUSH 0
CALL PostQuitMessage@4
MOV EAX, 0
FINISH:
POP EDI
POP ESI
POP EBX
POP EBP
RET 16
WNDPROC ENDS
_TEXT ENDS
END START

  • Ошибка lnk1169 обнаружен многократно определенный символ один или более
  • Ошибка lnk1168 не удается открыть exe для записи
  • Ошибка lnk1120 неразрешенных внешних элементов 1
  • Ошибка lnk1105 не удается закрыть файл
  • Ошибка lnk1105 visual studio