When compiling from the command line with cl.exe the name of the source file is printed by the compiler:
c:\bar> cl /nologo foo.cpp
foo.cpp
Is it possible to require cl.exe to not print that irrelevant info?
A test suite here invokes cl.exe with arbitrary source file names and it would be nice if cl remained silent when there is no diagnostics to emit.
Related
I'm compiling a program on windows using cmake and clang-cl with flags /Zi and /DEBUG:FULL. I can step through the program using VS code and it shows function names in the call stack.
However, when I try to disassemble with llvm-objdump, I get the whole .txt as a single block, no function names whatsoever. I want to check the disassembly of a single function but llvm-objdump says failed to disassemble missing function <name>. How can I make llvm-objdump recognize the exe symbols.
P.S. I'm familiar with linux and ELF but not really with EXE format, that's why I'm using clang instead of msvc.
When passing the linker switch debug:fastlink to Visual studio's linker (version 14.11.25547 - VS 2017 update 15.5) I always get a 5-7 second delay in my program execution when trying to run it inside VS debugger. I'm assuming the debug:fastlink option is the issue since when I remove it, everything works alright. Also, no change occurs if I try the option debug:full. It seems in order for VS debugger to hit my breakpoints the linker needs to be passed one of these options. Is anyone else having this issue? And is there any workout/solution for this? Just in case here is my build.bat file:
#echo off
set CompilerFlags= -DHANDMADE_SLOW_BUILD=1 -DHANDMADE_DEVELOPER_BUILD=1 -MT -Gm- -Z7 -nologo -Oi -Od -WX -W3 -GR -EHa-
set IncludePaths="w:\handmade\third party\sdl\include"
set LibraryPaths=/LIBPATH:"w:\handmade\third party\sdl\lib\x64"
set Libraries="SDL2.lib" "SDL2main.lib"
REM debug:fastlink/full options seem to slow the initial runtime of the app when trying to run in the debugger.
set LinkerFlags=-subsystem:CONSOLE -machine:x64 -incremental:no -nologo debug:fastlink -opt:ref
IF NOT EXIST build mkdir build
pushd build
REM 32-bit build
REM cl %CommonCompilerFlags% ..\handmade\code\win32_handmade.cpp /link -subsystem:windows,5.1 %CommonLinkerFlags%
REM 64-bit build
cl /c %CompilerFlags% -I %IncludePaths% w:\handmade\source\win32_handmade.cpp
link %LinkerFlags% -out:win32_handmade.exe ../build/win32_handmade.obj %Libraries% %LibraryPaths%
copy /y "w:\handmade\third party\sdl\lib\x64\SDL2.dll" "w:\handmade\build"
popd
I've been following a guido to compile a library into MATLAB. I've installer visualstudio14 so that i have a C++ compiler, then i used the vsvarsxx.bat to use the vs14 compiler with the cmd. For last, i went to the folder i want to compile and tiped nmake nmake -f Makefile.win clean all.
I used a following commands:
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
vsvars32.bat
cd C:\Users\Rafa\Desktop\estágio\PRoNTo_v2.0\PRoNTo_v2.0\machines\libsvm-3.20
nmake -f Makefile.win clean all
It runs whithout problem until i reach the final command. It pops up the following error:
erase /Q .obj windows. Could Not Find
C:\Users\Rafa\Desktop\estágio\PRoNTo_v2.0\PRoNTo_v2.0\machines\libsvm-3.20.obj
cl.exe /nologo /O2 /EHsc /I. /D _WIN32 /D _CRT_SECURE_NO_DEPRECATE -c
svm.cpp 'cl.exe' is not recognized as an internal or external command,
operable program or batch file. NMAKE : fatal error U1077: 'cl.exe' :
return code '0x1' Stop.
I have a Makefile.win: 03/25/2016 09:25 PM 732 Makefile 03/25/2016 09:25 PM 1,084 Makefile.win
I dont understand why that error pops up. Can somebody help me please ?
Could you check your %PATH% variable right before that point?
I'm thinking it may be overflowing, but that's just a theory.
If I run this cmd on cmd line using MS cl:
cl -c /W3 /Od ioapi.c
the object file, ioapi.obj is created as expected.
If however I create a makefile with this entry:
ioapi.obj: ioapi.c
cl -c /W3 /Od ioapi.c
There is a tab before cl above
and run make ioapi.obj then I get this error:
make ioapi.obj
cl -c /W3 /Od ioapi.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/W3', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/msys/1.0/W3' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/Od', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/msys/1.0/Od' ignored
ioapi.c
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/msys/1.0/W3', object file assumed
cl is the MS VS 2008 compiler.
I have installed minGW, version is from 6 months ago.
If I run make -n ioapi.c I get this reported as expected:
cl -c /W3 /Od ioapi.c
I am running cl.exe from the Visual Studio 2008 command prompt (where the VS2008 env variables are pre-setup).
Why am I getting this strange error and how to fix it?
I did wonder if it was a problem with the MS environment. But even if I run the vcvars32.bat file to setup the MS environment before running make it makes no difference.
I noticed that if I use this:
ioapi.obj: ioapi.c
cl -c ioapi.c
Then the error goes away. But I do need to pass in compiler switches.
The problem was make's handling of the /W3 /Od switches. It seems make thinks /W3 is the start of a file due to the / symbol. So to prevent this I changed the switches to use - instead of /. eg -W3 -Od which is acceptable to the MS complier/linker.
So the change in the makefile which was required is:
ioapi.obj: ioapi.c
cl -c -W3 -Od ioapi.c
I have many C files and I have built it by Visual Studio 2005 by commandline using a makefile.
All the object files are produced correctly and the linking process also works, but the final *.exe is not produced. At the last line, there is the error below. I understand nothing. Can anybody help me?
Here is the error:
process_begin: CreateProcess((null), /link /nologo /subsystem:console /o uartsim.exe xtmpmain.obj ua
rtsim.obj fiber_driver.obj xtmp_options.obj getopt.obj D:\usr\xtensa\XtDevToolsDE\install\tools\RB-2
008.4-win32\XtensaTools\lib\iss\xtmp.lib, ...) failed.
make (e=2): The system cannot find the file specified.
make.exe: *** [uartsim.exe] Error 2
Make can not find the uartsim.exe file. Either it's not on your computer, or it's not in your PATH.
Try to locate the file, check how the file path is passed to Visual Studio (environment variable, absolute path, just the executable name). If it's just the executable name, it means that you must have it in your PATH already to make it work.