Using Microsoft's NMAKE with -I option to for include paths. It works for the include files in these folders, but can't seem to find one in a named subfolder:
Here's the resulting command & error message:
cl /nologo /Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE -I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"; -I. "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys" "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" -DAVOID_WIN32_FILEIO -DCHECK_JPEG_YCBCR_SUBSAMPLING -DDEFAULT_EXTRASAMPLE_AS_ALPHA -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=8192 -DLOGLUV_SUPPORT -DNEXT_SUPPORT -DTHUNDER_SUPPORT -DLZW_SUPPORT -DPACKBITS_SUPPORT -DCCITT_SUPPORT -DTIF_PLATFORM_CONSOLE -DFILLODER_LSB2MSB /c tif_unix.c
tif_unix.c
tif_unix.c(35) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
Two things to note:
The "missing" file, "types.h", IS in the "sys" subfolder of one of the include paths, so "sys/types.h" should have been found, and
The "sys" subfolder was also included (out of desperation) and types.h STILL wasn't found.
Any ideas why this include file can't be found?
It looks like you're not using the option correctly. The syntax is -I directory, and according to the Microsoft documentation, to add more than one directory, you must use this option more than once. If you have faithfully reproduced the actual command-line you're using, then you have got -I directory -I directory directory directory directory, so several of your include directories are ignored.
Assuming you want all of these directories in the include path, the correct syntax is:
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"
-I.
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sys"
-I "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include"
-I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
Note the use of -I before each directory, including . .
Related
I need to replace some identifiers in my solution, to avoid conflicts with external dependencies.
I used the Find and Replace dialog, setting the Entire solution as scope. It works, but it is too long.
One possibility could be:
forfiles /s /p path\to\solution /m *.cpp /C "sed -i 's/oldid/newid/g' #file"
Anyway, I have external include directories located in path\to\solution, which means writing the line above for every project directory (and of course including also *.h files).
Instead, VS GUI is smart enough to parse *.h and *.cpp files, excluding external dependencies.
Is there some (Visual Studio) CLI tool to list solution files, excluding external dependencies?
I am using Mercurial for my source control and SourceTree to manage it. I want to use Visual Studio's built in diff and merge tool (vsdiffmerge) for comparing files however this is not working.
I am currently using the following:
Diff Commands:
\"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe\"
Diff Arguments:
\"$LOCAL\" \"$REMOTE\" //t
Merge Commands:
\"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe\"
Merge Arguments:
\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
The Visual Studio diff tool is not getting launched. Could you please take a look?
Update:-
We should use like below:-
Diff Command:
full path of vsDiffMerge.exe
For VS 2015 and below you can find it in the Visual Studio installation folder, under Common7\IDE subfolder. Visual Studio 2017 has it slightly more hidden. Look under Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.
Diff Argument: "$LOCAL" "$REMOTE" "Source" "Target" //t
Merge Argument: $LOCAL" "$REMOTE" "$BASE" "$MERGED" //m
For Visual Studio 2019 Enterprise vsDiffMerge.exe location is:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
For Visual Studio 2015
Put this line in the Diff Command box:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsDiffMerge.exe
And this one in the Arguments box:
$REMOTE $LOCAL $BASE $MERGED //m
You have a lot of useless (at least) blackslashes in commands and arguments
Read Setting Up DiffMerge page, second chapter and fix own mistakes
With Visual Studio 2015 Update 1 and SourceTree 1.7.0.32509 this is only setting, which works for me:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsDiffMerge.exe
$REMOTE $LOCAL $BASE $MERGED //m
Here's the full answer for VS 2019 diff and merge, works with Git and Mercurial.
Diff:
Diff Command: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
Arguments: $LOCAL $REMOTE //t
Merge:
Merge Command: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
Arguments: $REMOTE $LOCAL $BASE $MERGED //m
If you have the Enterprise VS edition, change the paths to this: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
worked for VS 2022
Diff Command:
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
Arguments:
$LOCAL $REMOTE //t
Merge Command: same
Arguments:
$REMOTE $LOCAL $BASE $MERGED //m
Follow this SO for more guidance
What are the command line arguments for TFS default merge tool for VS 2012?
Also these pointers
http://roadtoalm.com/2013/10/22/use-visual-studio-as-your-diff-and-merging-tool-for-local-files/
Truth is, I tried setting it up as well and didn't have much luck. I happen to use Beyond Compare. If you want it to work, at least stay within the choices that SourceTree offers in the drop-down list of external diff options. No good reason to use anything else they aren't supporting.
When I create .obj files with cl.exe, they have:
/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES"
Inside them. How to add more libs? cl.exe has no /DEFAULTLIB argument.
I try to unzip a file via CMD.
So I install winzip (and its plugin to cmd), winrar and 7-zip.
But when I try to execute a command via the CMD:
7z e myzip.zip
It gives the next error:
7z is not recognized as an internal or external command
In addition, I added the folder of 7-z to the environment variables (Properties--> advanced --> Environment Variables --> user variable --> choose path, and add C:\Program Files\7-Zip
What can be the reason?
Doing the following in a command prompt works for me, also adding to my User environment variables worked fine as well:
set PATH=%PATH%;C:\Program Files\7-Zip\
echo %PATH%
7z
You should see as output (or something similar - as this is on my laptop running Windows 7):
C:\Users\Phillip>set PATH=%PATH%;C:\Program Files\7-Zip\
C:\Users\Phillip>echo %PATH%
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Wi
ndows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\
WirelessCommon\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\To
ols\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fil
es (x86)\QuickTime\QTSystem\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Notepad+
+;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\7-Zip\
C:\Users\Phillip>7z
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<#listfiles...>]
<Commands>
a: Add files to archive
b: Benchmark
d: Delete files from archive
e: Extract files from archive (without using directory names)
l: List contents of archive
t: Test integrity of archive
u: Update files to archive
x: eXtract files with full paths
<Switches>
-ai[r[-|0]]{#listfile|!wildcard}: Include archives
-ax[r[-|0]]{#listfile|!wildcard}: eXclude archives
-bd: Disable percentage indicator
-i[r[-|0]]{#listfile|!wildcard}: Include filenames
-m{Parameters}: set compression Method
-o{Directory}: set Output directory
-p{Password}: set Password
-r[-|0]: Recurse subdirectories
-scs{UTF-8 | WIN | DOS}: set charset for list files
-sfx[{name}]: Create SFX archive
-si[{name}]: read data from stdin
-slt: show technical information for l (List) command
-so: write data to stdout
-ssc[-]: set sensitive case mode
-ssw: compress shared files
-t{Type}: Set type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
-v{Size}[b|k|m|g]: Create volumes
-w[{path}]: assign Work directory. Empty path means a temporary directory
-x[r[-|0]]]{#listfile|!wildcard}: eXclude filenames
-y: assume Yes on all queries
Regarding Phil Street's post:
It may actually be installed in your 32-bit program folder instead of your default x64, if you're running 64-bit OS. Check to see where 7-zip is installed, and if it is in Program Files (x86) then try using this instead:
PATH=%PATH%;C:\Program Files (x86)\7-Zip
make sure that your path is pointing to .exe file in C:\Program Files\7-Zip (may in bin directory)
In Windows 10 I had to run the batch file as an administrator.
I am trying to compile code, the makefile created using qmake.
When I run mingw32-make I get the following error:
cd bzip2-1.0.5\ && c:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\qmake.exe c:\Documents an
d Settings\user\My Documents\Visual Studio 2010\Projects\meshlab\meshlab\meshla
b\src\external\bzip2-1.0.5\bzip2-1.0.5.pro -o Makefile
Cannot find file: c:\Documents.
Cannot find file: and.
Cannot find file: Settings\user\My.
Cannot find file: Documents\Visual.
Cannot find file: Studio.
Cannot find file: 2010\Projects\meshlab\meshlab\meshlab\src\external\bzip2-1.0.5
\bzip2-1.0.5.pro.
mingw32-make: *** [bzip2-1.0.5\Makefile] Error 2
By the error it appears that mingw32-make doesn't understand paths that have spaces in them. Is that true? Is there a way around it?
The common way to do it in Linux/UNIX is to escape each space with a backslash, like: /c/Documents\ and\ Settings/User However, this doesn't always work in MinGW.
So, use the short (8.3) name. You get the short name with the Windows (not MinGW) command for %I in (<PATH>) do #echo %~sI where <PATH> can be . (show current directory, like pwd), * (list files in current directory), a particular file path, etc.
Btw, to copy from the awful cmd.exe window, click the icon in the upper-left corner of the title bar, go to Properties, Options, and enable QuickEdit Mode. Then you can select text with your mouse. The Enter key (or menu>Edit>Copy) copies the text to the clipboard. The insert key (or menu>Edit>Paste) pastes it.
From the MinGW "Getting Started" guide:
MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any location with spaces in the path name reference; i.e. you should avoid installing into any subdirectory of "Program Files" or "My Documents", or the like.
I suspect the same problems found in running executable files will also manifest itself with other files as well. You could try wrapping the whole thing (file specification) inside double quotes and this may work but Windows is sometimes not as logical as UNIX-based shells in this area.
Spaces in file names are evil anyway :-)
Not sure if this helpful or not (in fear of being downvoted), but I created a semantic link in order to avoid paths with spaces. Not sure if it will solve the problem since in my scenario it displayed a different error after I used the semantic link relating to pthreads which I still haven't been able to fix.
Creating semantic link using the command prompt:
mklink /j "C:\newshortcut" "C:\Program Files\Directory with spaces"
Then on the command you want to run, you use C:\newshortcut
Sorry for necroing this, but I had a similar problem and I was able to fix it using cygpath.
For my case I was trying to make an environment variable to visual studio:
export DEVENV="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/devenv.com
echo $DEVENV
$DEVENV $1 /build "Release|win64"
Which would result in:
/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/devenv.com
-bash: /c/Program: No such file or directory
The solution was to use cygpath -w to convert the path with spaces into an 8.3 filename:
export DEVENV=$(cygpath -w -s "/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/devenv.com")
echo $DEVENV
$DEVENV $1 /build "Release|win64"
Which results in:
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\Common7\IDE\devenv.com
and no error. Hopefully this helps future travellers.