g++: error unrecognized command-line option -municode using Cygwin - c++

I am trying to build GetDP (finite-element sofware) from source using the 64-bit GNU compilers in Cygwin, namely gcc.exe, g++.exe and gfortran.exe, with their toolchain x86_64-pc-cygwin. I have the same error while linking the executable getdp.exe (in my case raised by the g++ compiler):
g++: error: unrecognized command-line option ‘-municode’
How can I solve the issue? Are there some packages that can be installed within Cygwin to enable the -municode command in the toolchain of the compilers?
I have very little experience with C/C++ programming and compilation.
Any help is really appreciated.
Strictly related to this issue.

The problem was not in Cygwin compiler toolchains, but in the CMakeList.txt file of the software I was trying to compile (GetDP).
Now the issue is fixed and the executable can be built without any errors using both gcc and mingw-x64 within Cygwin.

Related

Problem with using clang as compiler for code::blocks

I installed llvm for clang, because I wanted to use clang for code::blocks as compiler, since I need compiler that supports c++20, so I installed llvm, the bin was added in environmental variables, even the code::blocks detected llvm as compiler, however I get error when i want to compile my code:
-------------- Build file: "no target" in "no project" (compiler: unknown)---------------
clang++.exe -c C:\Users\Temirlan\labs\lab4\rpn.cpp -o C:\Users\Temirlan\labs\lab4\rpn.o
clang++.exe -o C:\Users\Temirlan\labs\lab4\rpn.exe C:\Users\Temirlan\labs\lab4\rpn.o
C:\Users\Temirlan\labs\lab4\rpn.cpp:180:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
Do you know what is the problem or maybe the picture will help?
photo of compiler executables in code::blocks
I got error of "fatal error: 'iostream' file not found"
All modern compilers support C++20 (to slightly varying extent): both Clang, GCC, and MSVC. So this shouldn't affect your choice (but I do think that Clang is the best option).
Clang can be set up in different ways: (in order of personal preference)
With GCC's standard C++ library, libstdc++. Install MSYS2, then use it to install both Clang and GCC: pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-clang. Then use C:/msys64/ucrt64/bin/clang++.exe as the compiler. (There's also MINGW64 variant instead of UCRT64, read about the difference here).
With its own standard C++ library, libc++. Install MSYS2, then use it to install libc++-flavored Clang: pacman -S mingw-w64-clang-x86_64-clang. Then use C:/msys64/clang64/bin/clang++.exe as the compiler.
With MSVC's standard C++ library, aka MSVC STL. Install the official Clang build, and install Visual Studio.
Note that the first two options don't involve downloading the official Clang build. The official build wants the MSVC STL by default, which you don't have, since you didn't install VS. (And if you do install it, you might as well use it instead of CodeBlocks.)
The official Clang build can be made to work with other standard libraries, but they need to be installed separately, and you need to persuade it with some compiler flags. It's easier to install the MSYS2's version, which already uses the correct flags by default.

cc1plus: error: unrecognized command line option "-Wno-implicit-fallthrough" [-Werror]

I am getting this error when I am cross compiling compute library on x86 for arm by using SCons.
Here I am cross compiling this to run a tensorflow model on armnn sdk.
How I can solve this error?
Please give me suggestion.
-Wno-implicit-fallthrough was first added in gcc-7. You are probably using an older version of the compiler, which does not recognize the option.
You have several options:
Use later version of gcc
Remove -Wno-implicit-fallthrough flag from gcc call
Add -Wno-unknown-warning to suppress the warning

Recipe for target failed error in Eclipse using cygwin

First of all, I know that this question already exists multiple times in Stackoverflow but the answers provided for all of them didn't solve my issue(See section "Solutions worked for others" at the end of this question).
I am using the Eclipse IDE(Juno) with CDT plugin and Cygwin installed in my Windows-7 64-bit platform.
I successfully compiled and run the Hello World 'C' program but the Hello World "C++ program" is having Launch failed. Binary not found error.
I am also having recipe for target project.exe failed error in my auto-generated makefile.
Error line in makefile: #echo 'Building target: $#'
Additionally:
In c/c++ build -> toolchain editor ->
Current toolchain : Cygwin GCC
Current Builder : Gnu Make Builder
Used Tools:
GCC Assembler,
GCC Archiver,
Cygwin C++ Compiler,
Cygwin C Compiler,
Cygwin C Linker,
Cygwin C++ Linker.
When I change Current Builder from "Gnu Make Builder" to "CDT Internal Builder" the recipe for target project.exe failed error disappears but the Launch failed. Binary not found error still exists.
And also I dont have MinGW installed.
Solutions worked for others :
Before running the project directly using the run command, first Build the project and then run.
I build the project every time before I run it.
Eclipse can't find or point to an .exe file but the exe file runs fine when run from windows explorer and the answer to it is add -arch i386 to miscellaneous under linker.
My build runs without error but not creating the exe file. So this doesnt apply to me
Project->Properties->C/C++ Build->Settings->Binary Parsers
set "Cygwin PE Parser" and/or " PE Window Parser" and alike.
Tried all of them with different combinations but did not work
I also did :
adding the cygwin install dir to the path variable
added all the includes folders needed for cygwin for both GNU C and GNU C++ in Paths-and-Symbols -> includes
Saved the project before building and then running
restarted eclipse again
checked if g++ is installed using which g++ in terminal
and so on.
What could be a fix to this problem? Or do I have to install MinGW (I tried already to install MinGW with the installer.exe they provided and it failed on downloading the files several times) and try again.
I couldn't find the solution. Please show me what am I missing here.
Thanks in advance.

MinGW 4.7.1 doesn't recognize command line option -static-libstdc++

So I recently installed a new version of CodeBlocks with the MinGW 4.7.1 compiler, and I am no longer able to build my projects. The compiler throws the following error:
error: unrecognized command line option '-static-libstdc++'
I believe I was previously using 4.4.1 (going by the files in MinGW/bin). I installed the CobeBlocks 12.11 package that is supposed to come with the 4.7.1 compiler included.
How do I solve this? Removing that option from the compiler settings causes my previously functional application to instantly crash upon startup.
The compiler bundled with Codeblocks 12.11 is tdm-gcc 4.7.1, which by default links libstdc++ statically and reports -static-libstdc++ as an error. So if you want to dynamically link to libstdc++, add -shared-libstdc++.

Which Clang compiler should I download?

I want to install Clang compliler on my system. I went to this link, but so many download options out there confused me, as to which version should I download?
I'm using Dell's laptop : Windows 7 Basic 64-bit. I've already installed MinGW version 4.5.0. I've also installed Visual Studio 2008 as well as 2010.
What do you think is the best choice for me? Which Clang should I download? How should I configure it? I'm going to use Clang for the first time. So suggest me the best options!
By the way, can I configure Clang (or Visual Studio) so that Visual Studio may use Clang compiler to compile my C and C++ code?
EDIT:
What does it mean when the download page cryptically says "Front End Binaries for Mingw32/x86"?
You can use Clang with Visual Studio or MinGW. The choice is yours. But you'll need an external linker to produce Windows executables (MSVS's link.exe or MinGW's ld.exe/g++.exe).
If you want to use MinGW, download the next to last item (frontend binaries to mingw).
You can also compile Clang/LLVM from source, for that see here. This allows you to try out MSVS or MinGW(-w64). You'll need CMake for the build process.
UPDATE: regarding your edit: the "frontend" description reflects either the fact that llvm can be used as a backend in a GCC compilation through llvm-gcc (google has loads of info on this) or the fact that Clang itself is unable to link your code together into an executable or library. You still need the system's linker as I described above.
Clang now started releasing Windows snapshot builds
None. Front End Binaries # Mingw32/x86 is close, but you explicitly mentioned Windows 7 Basic 64-bit
so to be very specific you'll avail 64-bit benefits. So you'll follow steps at http://clang.llvm.org/get_started.html#buildWindows You may get VS2012 Express and the string with CMake should be "Visual Studio 11 Win64" Select Release instead of the default debug configuration from the dropdown and then build. Tool-chains are tightly coupled hierarchy, and MS's indulgence in non-standard extensions was never up-to-date by any other vendor implementation. Till llvm libcpp completes MinGW-W64 is the closest libstdc++ that I got from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-mingw_20111220.zip/download Check for newer build at http://mingw-w64.sourceforge.net/ Following are my trial calls for Hi console app
clang++.exe -fno-ms-compatibility -fno-use-cxa-atexit -IC:\mingw\include\c++\4.7.0 -IC:\mingw\include\c++\4.7.0\x86_64-w64-mingw32 -IC:\mingw\include\c++\4.7.0\backward -IC:\mingw\include -c C:\Users\Vipul\Documents\Hello.cpp -o C:\Users\Vipul\Documents\Hello.o
ld.exe -oC:\Users\Vipul\Documents\Hello.exe C:\Users\Vipul\Documents\Hello.o -m i386pep -Bdynamic -Lc:\mingw\lib c:\mingw\lib\crt2.o c:\mingw\lib\crtbegin.o -lstdc++ -lmingw32 -lgcc_s -LC:\Windows\SUA\opt\gcc64\lib\gcc\x86_64-pc-interix6\4.6.0 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 c:\mingw\lib\crtend.o
The parameters are set on one single occasion of configuring IDE setting for say Code::Blocks The libs to pass to ld linker are determined using -v along-with g++ as clang++ will try to link libc++ sources against VS2012 binaries. Using g++ rather than ld is easier but seldom fails with ld not found internally owing to close coupling of tool-chain by hardcoding tool locations within source.