I use the MS compiler from the command line (VS 2008), and whenever it compiles one source file, it prints the compiled source file. Is there a way to avoid this useless print ?
There's no way to suppress that message with a switch (see also this thread).
It sounds like you're using the /E switch which prints the source to the std output after it's run through the preprocessor.
Related
I'd like to use the debugger in Juno. I have multiple files, say file1, file2 and file3, all stored in one directory, say directory1. However, when I try to run the debugger, it claims
ERROR: could not open file /directory2/file3.jl
How come it does not find my files? It runs just fine, without the debugger. Do I need to change some PATH variable (REPL?) or something to tell it where to look for files?
Are you're includeing those files? If so, that's a bug in Juno's debugger.
Until this is fixed, you can either
use absolute paths in your include statements, e.g. include("/foo/bar/baz.jl") instead of include("baz.jl")
or directly enter the function call (with e.g. Juno.#enter start() or the "Run Block" command).
I think my error came from the fact that I just opened the debugger panel, without entering the correct command in the Juno command line :
Juno.#enter start()
where start() is the function that starts my program. Now everything compiles and runs at least.
While trying to setup the Cap'n Proto compiler as a custom build tool in Visual Studio 2017, I came across a curious behavior, it only seems to work when called directly and not through a batch file.
What I first tried was, for each .capnp file, set the following Custom Build Tool settings:
Command line: "$(SolutionDir)run_capnpn.bat" compile -oc++ "%(FullPath)"
Description: Executing capnp.exe on %(Identity)...
Outputs: %(Identity).c++;%(Identity).h
I made the batch file because I wanted to avoid polluting my %PATH% with the capnp folder, this is what it contains:
#echo on
echo %*
SET PATH=%PATH%;C:\GitHub\capnproto\bin\c++\src\capnp\Debug
start /wait "" capnp.exe %*
exit /b %errorlevel%
However, with this setup the Custom Build Tool was only called on 1 of the 5 capnp files in my solution (all 5 files had exactly the same settings). I know this because only one pair of generated files appeared and only one message appeared in my build log.
Even weirder, if I compiled again it would do the next file, and on the following compile it would do another file. In all, it would take 5 compiles (one per file) before it considered everything to be fully built and stop calling the custom build tool.
After much trial and error and some help from other programmers on Discord, I tried adding capnp.exe to my path and call it directly (instead of going through the batch file) so for each capnp fil I changed the command line setting to:
capnp.exe compile -oc++ "%(FullPath)"
and now it all builds correctly. Is it possible to call a custom build tool through a batch file? and if so how?
I have a project, which use a .rules file to build some non-c++ sources. How to make MSBuild print diagnostic output from this tool? -- Precisely cerr stream.
(I silently presume, the M$ team have not reached that level of insanity, to give the custom building tools functionality without possibility to print errors from them.)
I've actually noticed you marked question with label visual-studio-2008. I guess it means your custom build tool processes non cpp files in vc2008 project? If so, I think it is not built by msbuild but with vcbuild.
In this case try to add echo on in front of command executed by custom tool.
Vcbuild creates batch files in %temp% that first line contains #echo off and then it is executed. So if you add echo on you should see complete output in output window including command line used for command execution.
We want to use the preprocessor output file (.i file ) for further use, especially the comments.
For that, we use the /PREPRINT (or /PP) command line switch.
The problem is that the KEIL compiler (C166) deletes any comments.
Q: Is it possible to keep comments in the .i file?
Additional research:
The Microsoft compiler does this with the /P command line switch.
But they has /C to keep comments.
You can use
gcc -E -CC file.c
It keeps all the comments, including the ones in the .h files that may have been included by C file.
I turns out that the C166 Keil compiler supports also the /C compiler switch. This switch is not available through the IDE and is not documented.
To use it, we had to write a batch file that contains the /C switch and run the compiler a second time to create the .i file.
It also turns out that all of the compilers we use has this switch (Mircosoft, and as Arun Taylor mentioned, the GCC compiler). So we are able to use the commented .i file from every compiler.
I am using VS2008, and developing C/C++ projects. I am using .bat file to build my projects from commandline (VC2k8 command prompt). I need a way to include preprossor directive dynamically at build time.
I am using devenv to build from command line.
>devenv my\project\path\myproject.sln /build release > logs\build.log
Actually I want to set a macro definition based on a command line parameter to the batch file. I can keep two different .vcproj files, but that gives problem in keeping multiple project/sln files.
My batch file would something like this...
if (condition)
#define MYPROC_ENABLE_MYMODULE "yes" // To be included in the project.
else
#define MYPROC_ENABLE_MYMODULE "no"
Any help would be really appreciated.
Thanks.
One option would be to set the CL environment variable, using something like:
set CL=/DMYPROC_ENABLE_MYMODULE
The C++ compiler (cl.exe) will add the contents of the CL environment variable to its command line when it runs.
I know you can define macros if you build using msbuild, but I'm not sure you can do the same when using devenv directly.
You can make different configurations for your solution and define different preprocessor flags for the different configurations. Then you would just need to select the configuration at the command line and no need for multiple solution or project files.