Clang errors after deletion in /usr/bin and copying back - c++

Please don't ask me what on earth got into me deleting clang from the /usr/bin folder...I got weird error messages and couldn't find anything on the web...
However, I deleted clang, tried reinstalling Xcode + developer tools, but clang wasn't installed again. So I searched inside the Xcode folder and found it in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
So, I copied this (and clang++) back to my /usr/bin folder, but now I'm getting weird error messages again, e.g:
fatal error: 'stdarg.h' file not found
#include <stdarg.h>
^
1 error generated.
Any idea how I could fix this?

Try to link it instead of copying
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /usr/bin/clang

Related

Unable to resolve configuration with compiler Path

I have been getting this error message after installing VS code (New computer just reinstalling things) and I ran into this error message after installing splashkit + the c++ extension:
Unable to resolve configuration with compilerPath: C:/Users/willi/Documents/Code/102/Test/g++.exe
I would imagine I need to change the path variable but I am not sure.
Thanks
EDIT: I get this error message after using the command:
skm clang++ program.cpp -o One
I'm sure I am missing something easy here, but I haven't ran into this one before.

Xcode command line tools not finding header files (Catalina Update 10.15.7)

Recently I have updated my MacBook operating system to Catalina 10.15.7 and Xcode command line tools to 12.1. Ever since I have been getting the following error when I try to use any C++ compiler:
gcc A3v2.cpp
In file included from /usr/local/include/c++/9.2.0/bits/postypes.h:40,
from /usr/local/include/c++/9.2.0/iosfwd:40,
from /usr/local/include/c++/9.2.0/ios:38,
from /usr/local/include/c++/9.2.0/ostream:38,
from /usr/local/include/c++/9.2.0/iostream:39,
from A3v2.cpp:13:
/usr/local/include/c++/9.2.0/cwchar:44:10: fatal error: wchar.h: No such file or directory
44 | #include <wchar.h>
| ^~~~~~~~~
compilation terminated.
I have tried removing and re installing command line tools but it hasn't worked (amongst trying various other solutions I've found on Stackoverflow). When I run sudo find on wchar.h I get the following.
sudo find /Library -name wchar.h
find: /Library/Application Support/com.apple.TCC: Operation not permitted
/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h
As a current work around (as I need a c++ compiler for a current assignment) I have been using:
/usr/bin/gcc A3v2.cpp
however I'm hoping this will just be temporary. I think this is a path problem since the missing header file exsits? Not sure what I am doing when it comes to specifying file paths so please let me know if you know how to solve this. Thanks!

error when trying to compile with MinGW: cannot execute cc1plus

I did a clean install of MinGW on Windows 7 32bit with the GUI Installer, and installed
ming32-base-bin
mingw32-gcc-g++-bin
msys-base-bin
When trying to compile a simple "Hello World.cpp" from the cmd.exe i get the error:
C:\Users\Lorenzo\Desktop>g++ "Hello World.cpp" -o"Hello World.exe" -m32
g++: fatal error: cannot execute 'cc1plus': CreateProcess: No such file or directory.
compilation terminated.
The weird thing is that by grabbing the file from the desktop and putting it over g++.exe (so that i open the file with the application) in the MinGW directory, i don't get any error.
A temporary fix i found was to have a new environmet variable pointing in the folder where cc1plus is (C:\MinGW\libexec\gcc\mingw32\9.2.0). The program runs but doesn't include the libraries from C:/MinGw/lib and C:/MinGw/Include, i have to include those manually, which shouldn't occur (i guess).
I don't want to do this crude fix since i know i'll encounter some other problems with time.
Ok. I found the solution with some luck.
It is as simple as adding .exe to g++
> g++.exe *input file* -o*output.exe*
Don't Know if it's a bug or not, but this works for me.
I'm not sure which MinGW you used exactly, but it's better to use MinGW-w64.
There is a standalone build you can get from http://winlibs.com/ that doesn't require installation. The site also gives some instructions on how to use it.

Compiling phantom.js to LLVM IR

I downloaded the phantomjs source off of their github. I am trying to compile phantomjs into LLVM bytecode. However, when I run
> clang -S -emit-llvm main.cpp
It keeps saying:
In file included from main.cpp:31:
./utils.h:34:10: fatal error: 'QtGlobal' file not found
#include <QtGlobal>
^
1 error generated.
I'm on Ubuntu 14.04. Do I need to install Qt or something?
BTW, I'm not sure if StackOverflow is the best place to ask this, but I couldn't think of any other SE site that would be better.

why am i seeing this libzdb configure error?

I am attempting to install libzdb on my macbook however I see the following error message when running the configure:
configure:13334: error: setjmp is required
the setjmp.h file resides within /usr/include and is specified within my "$PATH" as
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/include
Can someone please advise as to how i can rectify this issue?
thanks in advance
I've stumbled across this error while building one of my own programs when I wanted to use setjmp() and longjmp(). For some reason, the toolchain that resides in / on OS X is flawed, and the <setjmp.h> header file is missing the declarations and data types.
To fix it, I had to download Xcode (damn!) and tell the compiler to look for the headers in the freshly installed MacOSX10.7.sdk (or 8) folder:
clang -Wall -o foo foo.c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
ok finally figured it out. For those who have seen messages like this be warned that the configure logs can be misleading. It turned out the binary built fine, however it was failing during runtime because a few mysql libraries could not be found. using the following command *export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/* would fix the problem