Link error lnk1104 scintillia, visual studio command prompt 2017 using nmake - visual-studio-2017

Hello i am trying to get into opensource, and i wasted the whole day yesterday trying to solve this problem. I am trying to build Scintilla for notepad++, and i had first allot of errors like certain files could not be found, or rc could not be found by visual studio command prompt.
I managed to fix those errors but there is a last one i cant figure out.
I have been following this
After building with the script provided, i run
nmake -f scintilla.mak
and the result:
LINK : fatal error LNK1104: cannot open file '..\bin\Scintilla.dll'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.EXE"' : return code '0x450'
Stop.
link -OPT:REF -LTCG -DEBUG -LIBPATH:F:\sources\boost_1_65_1\boost_1_65_1\bin.v2\libs\regex\build\msvc-14.1\release\link-static\runtime-link-static\threading-multi -DEF:Scintilla.def -DLL -OUT:..\bin\Scintilla.dll .\AutoComplete.obj .\CallTip.obj .\CaseConvert.obj .\CaseFolder.obj .\CellBuffer.obj .\CharacterCategory.obj .\CharacterSet.obj .\CharClassify.obj .\ContractionState.obj .\Decoration.obj .\Document.obj .\EditModel.obj .\Editor.obj .\EditView.obj .\Indicator.obj .\KeyMap.obj .\LineMarker.obj .\MarginView.obj .\PerLine.obj .\PlatWin.obj .\PositionCache.obj .\PropSetSimple.obj .\RESearch.obj .\RunStyles.obj .\Selection.obj .\Style.obj .\UniConversion.obj .\ViewStyle.obj .\XPM.obj .\HanjaDic.obj .\ScintillaBase.obj .\ScintillaWin.obj .\BoostRegexSearch.obj .\UTF8DocumentIterator.obj .\ScintRes.res KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB OLEAUT32.LIB
Microsoft (R) Incremental Linker Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.

I solved it, turns out the bin directory was removed for some reason, i should have seen it sooner cause of the warning message.
To anyone who gets similar error, it means the directory or file you are trying to access is not there, so maybe faulty path or folder removed.

Related

error MSB6006: "link.exe" exited with code 1 When run SDV ( Static Driver Verifier) , Visual studio 2019 , SDK 10 build 19041, windows 10 build 19041

We create new KMDF USB project ,
Open visual studio 2019 v 16.11, go to File -> new -> project -> chose Kernel Mode Driver, USB (KMDF).
without any modification, this project have no error, no warning when building.
when we run SDV ( Static Driver Verifier) for this project the smvbuild.log show this error.
C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wmilib.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfLdr.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfDriverEntry.lib" usbdex.lib ntstrsafe.lib "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wpprecorder.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"FxDriverEntry#8" /RELEASE /IMPLIB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X86 /PROFILE /SAFESEH /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221 /osversion:10.0 /pdbcompress /debugtype:pdata Release\Device.obj
Release\Driver.obj
Release\Queue.obj
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1074,5): error MSB6006: "link.exe" exited with code 1. [C:\Users\tungpvt\source\repos\USB Driver2\USB Driver2\USB Driver2.vcxproj]
Done executing task "Link" -- FAILED.
Done building target "Link" in project "USB Driver2.vcxproj" -- FAILED.
Done Building Project "C:\Users\tungpvt\source\repos\USB Driver2\USB Driver2\USB Driver2.vcxproj" (rebuild target(s)) -- FAILED.
In additional, when running the link.exe on command line, Visual studio -> Tools -> Command Line -> Developer Command Prompt with same parameter like above it shows:
Failed to load Intercept.XML:
Could not find file 'c:\program files (x86)\windows kits\10\tools\sdv\smv\bin\%BE%-Intercept.xml'.
we've added the BE and smv variables to Windows system environment
variable name: BE , variable value: MSBuild
variable name: smv , variable value: C:\Program Files (x86)\Windows Kits\10\Tools\sdv\smv
In Linker session in Project properties, we modified Project properties -> Linker -> Input -> Additional Dependency to
%(AdditionalDependencies);$(DDK_LIB_PATH)usbdex.lib;$(DDK_LIB_PATH)ntstrsafe.lib
Then we can pass the command line
C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wmilib.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfLdr.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfDriverEntry.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\usbdex.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntstrsafe.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wpprecorder.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"FxDriverEntry#8" /RELEASE /IMPLIB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X86 /PROFILE /SAFESEH /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221 /osversion:10.0 /pdbcompress /debugtype:pdata Release\Device.obj
Release\Driver.obj
Release\Queue.obj
But still run the SDV error.
please help me to fix this.
thanks.
===========================================================================
After I update to latest SDK, WDK to version 10.1.22000, and update visual studio 2019 and the error of the template driver gone away, but I facing other problem in my project in
sdv/smvcl.log
c1 : fatal error C1252: Circular or missing dependency between plugins: 'PREfast Drivers Plugin' requires GUID '{EB170136-3433-4C16-AE1D-8998BA5CAB16}'.
can anyone help me?
Hi I had this problem (linker error on static driver verifier build) with WDK 10.0.22000 (with visual studio 2019) and here's the solution I've found: it links when the macro NT_PROCESSOR_GROUPS is defined at compile time (have to rebuild all), so adding this macro to the preprocessor definitions does the trick (at least for my setup).
Just in case you are running across static driver verifier failures now or in the future, here is a useful hint:
Run SDV target with /debug enabled: so
msbuild /t:sdv /p:Inputs="/check:* /debug" path\to\myproject.vcxproj /p:Configuration=Release /p:Platform=x64 /maxCpuCount=8
will create debug logs. The output of the linker is found in the sdv subdirectory
and is named smvlink1.log . There are other useful logfiles in that directory (took me a long time to find them but the output directed me to the solution I proposed above).
You're not alone in encountering problems with SDV in Visual Studio 2019. I ran into this with a mature driver after updating the tools and rebuilding. Fortunately, as is often the case, the good guys at OSR already ran headfirst into this wall themselves, and found a solution:
It seems that if you try to run SDV on a driver project that has “Enable Code Analysis on Build” set to YES, SDV will always fail in the way you see illustrated above. So, the fix is to disable Code Analysis on Build and be sure to save the project to disk. Then run SDV.
The driver I was working on did indeed have "Enable Code Analysis on Build" turned on. Turning it off allowed SDV to build it successfully.

Error linking to x86.obj

Using Visual Studio 2017 RC, I get this compile error:
LINK : fatal error LNK1181: cannot open input file 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24728\lib\x86.obj'
x86.obj does not exist on my system. Yet, the compiler wants to link to it, although I have not instructed so in the project properties. Does it misinterpret a folder name ($(VC_LibraryPath_x86)) as an object to which it has to link? Could it be a bug?
On the other hand, I found out that a similar problem also occurs in Visual Studio 2015, there is even an (unanswered) question on it: LNK1104 cannot open file '...lib.obj'
Does anyone have an idea what is going wrong here? Thanks.
--
Diagnostic build output:
LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24728\lib\x86.obj'
The command exited with code 1104.
Output Property: LinkSkippedExecution=False
Done executing task "Link" -- FAILED.

link.exe returns error LNK1181: cannot open input file 'C:\Program.obj'

I'm compiling with a Batch file containing
#echo off
set link=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link
"%link%" external_input.obj periodic_dinger.obj flagger.obj monitor.obj main.obj libGui.lib libCore.lib libCint.lib libRIO.lib libNet.lib libHist.lib libGraf.lib libGraf3D.lib libGpad.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libMathCore.lib libThread.lib
All the objects and libraries are in the same directory, which is the directory I'm executing the Batch file from, and also where the Batch file is located. I've tried adding the current directory to /LIBPATH:, but no luck. My LIB environment variable is
C:\Users\jroth\Data\online_monitor_v.0.5>echo %LIB%
"C:\Program Files\ (x86)\Microsoft Visual Studio 11.0\VC\LIB";"C:\Program Files
(x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB";"C:\Program Files (x86)\Window
s Kits\8.0\lib\win8\um\x86";
I made sure that everything was quoted. The same error came up when everything was unquoted. The error verbatim is
C:\Users\jroth\Data\online_monitor_v.0.5>make
Microsoft (R) Incremental Linker Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'
make.bat is the name of the batch file I'm using to link this, not a makefile.
I'm running vcvarsall.bat before doing any of this.
The problem was with the environment variable link that you used. The MS linker also uses this variable for flags.
From https://msdn.microsoft.com/en-us/library/6y6t9esh.aspx:
The LINK tool uses the following environment variables:
LINK, if defined. The LINK tool processes options and arguments defined in the LINK environment variable before processing the command line.
So you can't use set link=..., you'll have to use another name. _link will do fine.

Why does compiling Wireshark from source fail?

I have been following this documentation to compile Wireshark from source:
http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
I am running these commands from going to Start > 'All Programs' > Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Command Prompt
I am also calling "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" but I believe this may be done for me with the VS2008 Command Prompt.
Here is the output of my nmake -f Makefile.nmake verify_tools :
Checking for required applications:
cl: /cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/BIN/cl
link: /cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/BIN/link
nmake: /cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/BIN/nmake
mt: /cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1/bin/mt
bash: /usr/bin/bash
bison: /usr/bin/bison
flex: /usr/bin/flex
env: /usr/bin/env
grep: /usr/bin/grep
/usr/bin/find: /usr/bin/find
peflags: /usr/bin/peflags
perl: /usr/bin/perl
C:\Python27\python.exe: /cygdrive/c/Python27/python.exe
sed: /usr/bin/sed
unzip: /usr/bin/unzip
wget: /usr/bin/wget
After this I continue to run the commands:
nmake -f Makefile.nmake setup
nmake -f Makefile.nmake distclean
nmake -f Makefile.nmake all
After calling the last command ('all'), The compilation runs for several minutes and comes to tshark-tap-register.c
tshark-tap-register.c(6) : error C2182: 'File' : illegal use of type 'void'
tshark-tap-register.c(6) : error C2146: syntax error : missing ';'
before identifier 'STDIN'
It continues in this fashion, citing increasing line numbers with the same errors. Finally, it halts, outputting :
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
If anyone has suggestions on things to try, I would greatly appreciate it!
Since you are building the development snapshot out of SVN, you probably just pulled a revision that had an error somewhere that caused tshark-tap-register.c to be incorrectly generated. Both 43154 and 43155 build for me without issue.
Unless you need the bleeding-edge features in the development branch, you should in stead get the latest stable source distribution from the Wireshark Downloads page in the future.

QWT installation errors

I started using Qt a few weeks ago and I am really enjoying it. I now need to include graphs in my application and, after some research, I found that Qwt was the best way of doing so (rather than having to do everything from scratch by myself). I've been at it for a couple of days, and I can't figure out how to install it. I am using windows7 32 bit. I followed the instructions in the INSTALL file:
from cmd ->
qmake qwt.pro
nmake
after nmake finishes I am left with errors
C:\Users\Peyo\Downloads\qwt-6.0.1>qmake qwt.pro
C:\Users\Peyo\Downloads\qwt-6.0.1>nmake
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
cd src\ && "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.e
xe" -f Makefile
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f Make
file.Debug all
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
moc qwt_dyngrid_layout.h
moc qwt_magnifier.h
moc qwt_panner.h
moc qwt_picker.h
moc qwt_text_label.h
moc qwt_legend.h
moc qwt_legend_item.h
moc qwt_plot.h
moc qwt_plot_renderer.h
moc qwt_plot_canvas.h
moc qwt_plot_panner.h
moc qwt_plot_picker.h
moc qwt_plot_zoomer.h
moc qwt_plot_magnifier.h
moc qwt_sampling_thread.h
moc qwt_scale_widget.h
moc qwt_abstract_slider.h
moc qwt_analog_clock.h
moc qwt_compass.h
moc qwt_counter.h
moc qwt_dial.h
moc qwt_knob.h
moc qwt_slider.h
moc qwt_thermo.h
moc qwt_wheel.h
compiling .\qwt_abstract_scale_draw.cpp .\qwt_interval_symbol.cpp .\qwt_clipper.
cpp .\qwt_color_map.cpp .\qwt_column_symbol.cpp .\qwt_interval.cpp .\qwt_dyngrid
_layout.cpp .\qwt_math.cpp .\qwt_magnifier.cpp .\qwt_panner.cpp .\qwt_null_paint
device.cpp .\qwt_painter.cpp .\qwt_picker.cpp .\qwt_round_scale_draw.cpp .\qwt_s
cale_div.cpp .\qwt_scale_draw.cpp .\qwt_scale_map.cpp .\qwt_spline.cpp .\qwt_tex
t_engine.cpp .\qwt_text_label.cpp .\qwt_text.cpp .\qwt_event_pattern.cpp .\qwt_p
icker_machine.cpp .\qwt_point_3d.cpp .\qwt_point_polar.cpp .\qwt_scale_engine.cp
p .\qwt_symbol.cpp .\qwt_system_clock.cpp .\qwt_curve_fitter.cpp .\qwt_legend.cp
p .\qwt_legend_item.cpp .\qwt_plot.cpp .\qwt_plot_renderer.cpp .\qwt_plot_xml.cp
p .\qwt_plot_axis.cpp .\qwt_plot_curve.cpp .\qwt_plot_dict.cpp .\qwt_plot_direct
painter.cpp .\qwt_plot_grid.cpp .\qwt_plot_histogram.cpp .\qwt_plot_item.cpp .\q
wt_plot_intervalcurve.cpp .\qwt_plot_spectrogram.cpp .\qwt_plot_spectrocurve.cpp
.\qwt_plot_scaleitem.cpp .\qwt_plot_seriesitem.cpp .\qwt_plot_marker.cpp .\qwt_
plot_layout.cpp .\qwt_plot_canvas.cpp .\qwt_plot_panner.cpp .\qwt_plot_rasterite
m.cpp .\qwt_plot_picker.cpp .\qwt_plot_zoomer.cpp .\qwt_plot_magnifier.cpp .\qwt
_plot_rescaler.cpp .\qwt_raster_data.cpp .\qwt_matrix_raster_data.cpp .\qwt_samp
ling_thread.cpp .\qwt_series_data.cpp .\qwt_scale_widget.cpp .\qwt_plot_svgitem.
cpp .\qwt_abstract_slider.cpp .\qwt_abstract_scale.cpp .\qwt_arrow_button.cpp .\
qwt_analog_clock.cpp .\qwt_compass.cpp .\qwt_compass_rose.cpp .\qwt_counter.cpp
.\qwt_dial.cpp .\qwt_dial_needle.cpp .\qwt_double_range.cpp .\qwt_knob.cpp .\qwt
_slider.cpp .\qwt_thermo.cpp .\qwt_wheel.cpp
NMAKE : fatal error U1077: 'echo' : return code '0xc0000135'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\bi
n\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
there are three errors:
NMAKE : fatal error U1077: 'echo' : return code '0xc0000135'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\bi
n\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
And I can't figure out how to solved them. Please help! If I am missing any details, let me know and I'll add them. Thanks!
Try running this from Visual Studio command prompt, it set special vcvars stuff you don't have when running in windows command prompt
Better used mingw32-make instead of nmake.
It should work.
I hope your problem will be solved.