Setting up bazel as an environment variable windows - c++

I've been trying to use bazel on Windows 10 Pro, and I was following the instructions located at https://docs.bazel.build/versions/3.7.0/install-windows.html
I found the place to add user-specific and system-wide environment variables, and I added the path to bazel.exe and called the variable bazel, but when I try to type bazel into a command prompt window, it still isn't recognized.
Let me know if you need any more detail to help answer my question, I'm confused where I'm going wrong.

I think that you have to add the bazel binary path to your 'path' environment variable.
So search for Edit system environment variables -> Advanced -> Environment variables
and then under System Variables -> path -> edit you can add the path of your bazel bin (C:\User\Panda\Documents) and it should work. Detailed description with screenshots it's here: https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

You are trying to use bazel as a command, not as an environment variable. When you want to use the value of an environment variable, you need to surround the name in %s, ie:
C:\Users\Panda>%bazel% version
UPDATE: otherwise, since the .exe file you want to execute is also named bazel, it can be executed as a command, you would just need to add the path to bazel.exe's installation folder (C:\Users\Panda\Documents) to your system's %PATH% environment instead 1, as #Fed's answer explained, and then you can execute bazel normally:
C:\Users\Panda>bazel version
1: I don't recommend installing apps in your user profile's Documents folder! You should create a new folder for installing bazel into, preferrably under C:\Program Files (64bit) or C:\Program Files (x86) (32bit). Then you can add %ProgramFiles%\bezel\ to your %PATH% environment.

Related

Append bin folder to PATH environement variable after installation

I have done a C++ program for Windows and an NSIS installer using CPack.
I want that after the installation, the user can call my program from the terminal without giving the whole path of the exe.
Sometimes some installers even add an Add useful environment variables checkbox at the end of the installation to give the user a choice.
Is it possible to add to the PATH environment variable the path to our bin folder at the end of the installation using CPack and NSIS Generator?
If this is not possible, how do other programs add environment variables during installation?
As always, check the documentation... https://cmake.org/cmake/help/latest/cpack_gen/nsis.html
CPACK_NSIS_MODIFY_PATH
   Modify PATH toggle. If this is set to ON, then an extra page will appear in the installer that will allow the user to choose whether the program directory should be added to the system PATH variable.
Note that this is hard-coded to be the $INSTDIR\bin path and is not configurable. In particular, setting CMAKE_INSTALL_BINDIR to anything other than bin will break.

Missing xxx.dll when performing built executives in visual studio

The system warned that missing opencv_core331.dll
However, I have added the path of directory that include opencv_core331.dll to the environment variables of Windows:
Who can help?
This is a run-time issue, the libraries path has nothing to do with it. You need to either edit the global PATH variable or the executable directories in the project properties. I would personally recommend the global PATH variable because that way your program will run outside of VS as well as from it.
To do so, in the start menu search box type "environment" and select the ""Edit system environment variables" if you want to make the change for all accounts.environment variables for your account" or (

Qt Creator Modify PATH Environment Variable

I'm trying to find an equivalent feature in Qt Creator that I currently know how to do in Visual Studio.
In Visual Studio I'm able to modify the PATH environment in the Property Pages-> Configuration Properties-> Debugging-> Environment and I can set something like:
PATH=%PATH%;%MYENVIRONMENTVAR%
Where MYENVIRONMENTVAR points to a directory (lets call it C:\MYIMPORTANTDLLS) containing dlls needed for my program to run.
I'm looking for the equivalent of this in Qt Creator. In Qt Creator I thought I would accomplish this in Projects-> Select the Run tab-> Expand the Build Environment Details and modify the Path there. But I can't append an environment variable to the end of the PATH in that location. Instead I have to append the path contained in my environment variable to the end of the entire PATH, which would look something like this: PATH=C:\path1;C:\path2;C:path3;...etc...;C:\MYIMPORTANTDLLS.
If any of you know how this is done in Qt Creator then I would appreciate your help.
There is a way to specify other dependencies of the project immediately in the project .pro file. Example from project file:
OTHER_FILES += ..\third-party\libxml2\bin64\libxml2.dll \
..\third-party\libiconv\bin64\libiconv.dll
You were so close with opening Projects-> Select the Run tab (or Build if you need to change the path for the build step) -> Expand the Build Environment Details and modify the Path there. Then edit the PATH variable to
$(PATH);C:\YourPathAddition

Building VC++ 6 project from TeamCity. Can't find header files

I have a VC++ project and I have got the .dsw file. I want to build the project through TeamCity and obtain the .dll file.
In the TeamCity, In Build Steps I have given the Runner type as Command Line and passing in the following parameters.
Myproject.dsw /MAKE "Myproject - Win32 Release MinSize"
It creates empty output directories and all but I get this error
fatal error RC1015: cannot open include file 'afxres.h'
I have checked that the file is located at 'C:\ProgramFiles\Microsoft Visual Studio\VC98\MFC\Include'.
I don't understand why it is not picking up the file from this location. I tried adding this location to Environment Variable PATH, but it does not work.
The TeamCity picks up few files from 'C:\ProgramFiles\Microsoft Visual Studio\VC98\Include' though.
Please help.
I some how figured out the solution for this.
The TeamCity Agent runs as a windows service. So, it can not access the User environment variable for e.g. %include% and %lib%.
What I did is, I passed these two variables as environment variables to TeamCity Build. And voila!!! It works. :)

How do I add the MinGW bin directory to my system path?

I am using Windows XP. I am trying to add a new library to Dev-C++. For that, I need to install MinGW and then I have been instructed to add the bin directory of MinGW to my system path. But, I don’t know how to do it. Please guide me (step by step) to add this to my system path.
To change the path on Windows XP, follow these instructions, and then add the directory where you install MinGW plus bin. Example: if you install MinGW in C:\ then you have to add C:\mingw\bin to your path
Just for completeness here are the steps shown on the link:
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32;c:\mingw\bin