On Ubuntu 14.04, I have llvm/clang and all the libraries installed. I am able to run the LLVM Kaleidoscope example from the command line with -std=c++11 -stdlib=libc++
I tried importing the Kaleidoscope code into Eclipse CDT. I added the /usr/include/c++/v1 path to the libc++ library. However, I'm getting the following error:
Type 'std::string' could not be resolved
How do I fix it? Am I missing some defines?
Note: I'm not trying to compile the code through CDT. I'm just trying to get the indexing to work.
Related
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.
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.
I was struggling to get some C++ code that involves the header
#include <execution>
working in XCode (Version 11.4 (11E146)) through macOS Catalina Version 10.15.3, as it failed with error:
'execution' file not found
Finally I was able to compile my code by installing the gcc-HEAD version from brew:
$ g++ --version
g++ (Homebrew GCC HEAD-93a49d2) 10.0.1 20200407 (experimental)
However, I'm still struggling to use this g++-HEAD version through XCode. I tried in XCode's "Build Settings" this way:
I also tried to change in above settings: Dialect from C++17 to GNU++17 [-std=gnu++17], and C++ Standard Library to libstdc++ (GNU C++ standard library). But XCode still complains that it couldn't find 'execution' file.
As suggested by #walnut, it seems that I need to set up the clear path to the entirely different compiler other than XCode's default clang. What shall I write down in the below window?
Thanks!
While trying to set up OF on eclipse (linux mint 17), I keep getting the following error :
g++: error: unrecognized command line option ‘-std=c++14’
I cannot find a solution online. I have tried updating my g++, replacing my libs/frameworks/video files with the latest on github, but nothing seems to work.
Though this issue has been closed here, i am unable to solve mine.
Is there a way to change the make file so that it builds successfully?
g++ doesn't support -std=c++14 until 4.9
See (for example) https://askubuntu.com/questions/428198/getting-installing-gcc-g-4-9-on-ubuntu for how to install 4.9 on Ubuntu
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++.