How to fix "'g++' is not recognized as an internal or external command, operable program or batch file." - g++

I recently downloaded CLion onto my Windows machine. I have cygwin64 installed with g++-gcc, make, cmake, and gdb. It is selected under the toolchain tab as my default environment.
I have looked at the system variable section within "Environment Variables" but perhaps I am not indicating the correct path(s).
C:\Users\kdagh\CLionProjects
I should be able to compile with g++ but only receive the error:
'g++' is not recognized as an internal or external command, operable program or batch file.

Related

'protoc' is not recognized as an internal or external command, operable program or batch file

When I tried this for Protobuf Compilation by cmd
protoc object_detection/protos/*.proto --python_out=.
It shows me
'protoc' is not recognized as an internal or external command, operable program or batch file.
How to fix this ??
It is likely that you had the same problem I had.
Are you following the TensorFlow 2 Object Detection API tutorial?
At some point you go to the protoc release pages and see downloads such as
"protobuf-all-3.17.0.zip" and "protoc-3.17.0-win64.zip" (BIG difference). Make sure you download "protoc" and not "protobuf-all".
Make sure you can find "protoc.exe" in the folder you extract. Example, in my computer I have:
C:\Program Files\Google Protobuf\bin\protoc.exe
"protoc.exe" is the compiler.
If anyone reading this is totally lost, see if you can find your c++ compiler.
For me it is
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe
and the compiler is called "cl.exe"

Dynamic Loader of Executable in Valgrind Ignoring LD_LIBRARY_PATH

LD_LIBRARY_PATH=/otherRoot/lib/ valgrind myProg
chroot /otherRoot valgrind myProg
When running the first command, valgrind gives me errors about a stripped dynamic linker because it apparently is not using the one in /otherRoot/lib. Using the second command, it finds my the appropriate .so and works.
For reference, I have valgrind installed in the "normal root" and "otherRoot" as well.
Why does valgrind/myProg not search for the .so in /otherRoot/lib first?
When running the first command, valgrind gives me errors about a stripped dynamic linker because it apparently is not using the one in /otherRoot/lib.
The dynamic loader your program uses doesn't (can't) depend on LD_LIBRARY_PATH, because it is the kernel the loads the dynamic loader (and the kernel generally doesn't care about environment variables). More info here.
Outside of chroot, the "wrong" dynamic loader is used with or without valgrind. You can confirm this by pausing myProg and examining /proc/$PID/maps for it.

"a bin target must be available for 'cargo run'"

While building a new Rust "Project from other sources", in Intellij IDEA 2017, I was unable to run the project through its UI.
C:/Users/sjsui/.cargo/bin/cargo.exe run error: a bin target must be
available for cargo run
Process finished with exit code 101
I noticed that no --bin target was provided by my build configuration so I placed the path to the projects target folder; same result.
C:/Users/sjsui/.cargo/bin/cargo.exe run --bin C:\Users\sjsui\exercism\rust\hello-world\target\debug
error: no bin target named C:\Users\sjsui\exercism\rust\hello-world\target\debug
I tried creating a fresh Rust project through the Cargo command line interface, and received this error when running it:
error: could not exec the linker link.exe: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but link.exe was
not found
note: please ensure that VS 2013 or VS 2015 was installed with the
Visual C++ option
Evidently I must install Visual C++ build tools 2017 and am in the process of doing so. Are these errors related, or different issues?
By default, Cargo will consider the file src/main.rs to be the main binary target for the package. If this file doesn't exist, and there are no other binary targets defined in Cargo.toml, you'll get this error.
According to the documentation, when you create a Rust project in IntelliJ IDEA, you get an option to Use a binary (application) template. This should give you a src/main.rs instead of a src/lib.rs (which is the default root file for a library target). Using Cargo on the command line, you can also create an application package with cargo new hello.
Cargo defaults to --bin to make a binary program. To make a library, we'd pass --lib.
When you use --bin on the cargo run command, the argument refers to one of the [[bin]] sections in Cargo.toml, or files following the pattern src/bin/*.rs (the argument replaces the *) if there are no [[bin]] sections in Cargo.toml. For example, cargo run --bin foo will either compile and run src/bin/foo.rs or the [[bin]] section with name = "foo" in Cargo.toml.

build .cpp in windows using cmake

I was trying to build my .cpp file in Windows platform (windows 10) using CMake.
My .cpp file makes use of two external libraries:
armadillo
libsnd file.
I have written a corresponding CMakeLists.txt to compile and obtain the binary.
I was successful in doing so in Linux. But when it come to Windows I was not able to do so:
Current branch master is up to date.
No patch step for 'project_libsndfile'
Performing autogen step for 'project_libsndfile'
Performing configure step for 'project_libsndfile'
'C:\Users\computing7\Desktop\TSM_cmake\build\lib\libsndfile\src\project_libsndfile\configure' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 9009.
Done executing task "CustomBuild" -- FAILED.
Done building target "CustomBuild" in project "project_libsndfile.vcxproj" -- FAILED.
Build FAILED.
1) Is it possible to build libsnd in Windows? (coz, I came across documents which state that libsndfiles work only in Linux).
2) Could you please provide some guidance.

g++ is not recognized as an internal or external command, MinGW

I am running windows 8 x64. I have just installed the GNU C++ compiler through MinGW.
When I try to test this in the command line I get:
g++ is not recognized as an internal or external command
If I change to the directory c:/MinGW/bin and run g++ it works.
I have set the path to c:/MinGW/bin. This appears when I enter echo %path% and I have tried restarting my computer after changing the path variable.
I've searched the internet and the advice I've gotten back is change the path variable. I have done this and I am looking for a different solution to this problem.