g++: error: libgomp.spec: No such file or directory - c++

I use g++ (GCC) 4.7.2. on Windows 7, 64-bit version.
downloaded from http://nuwen.net/mingw.html
I tried to use the "-fopenmp" flag and got the error:
g++: error: libgomp.spec: No such file or directory
I can't find the file anywhere on my system. Do I need to re-install something? Can I just throw a file somewhere?

You could try installing TDM-GCC, which looks as though it includes OpenMP.
There's also Sezero's personal build.

I had a similar problem. I got it working installing one of the version at the following discussion.
Which version of MinGW should I use
I don't have access to my windows machine now so I don't know which version I used but I can check on Monday if you don't have it working by then.
It might have been this one.
http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/

Related

'wchar.h' file not found

I know about this question: macOS 'wchar.h' File Not Found
but it did not help me. I've tried reinstalling xcode, reinstalling command line tools, restarting the system. wchar.h file is in place, but the compiler does not manage to find it. What else could I try? Maybe it is sysroot related? Any way to fix that?
macbooks-MacBook-Pro:Rack euphorbium$ sudo make
c++ -Iinclude -Idep/include -Idep/lib/libzip/include -DVERSION=dev -MMD -O3 -march=core2 -ffast-math -g -Wall -DARCH_MAC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -DAPPLE -stdlib=libc++ -std=c++11 -stdlib=libc++ -c -o build/src/app.cpp.o src/app.cpp
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' [-Wmissing-sysroot]
In file included from src/app.cpp:1:
In file included from include/app.hpp:2:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:90:
/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h:119:15: fatal error:
'wchar.h' file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.
make: *** [build/src/app.cpp.o] Error 1
since wchar.h exists both in the xcode app, and in the /Library/Developer/CommandLineTools I think that it looks for it in some completely unrelated folder.
I had the same problem after upgrading to macOS High Sierra. A project which was compiling before stopped working with this error. In my case, the project files had been generated by the CMake application. The solution was to run CMake, 'Delete Cache', and 'Configure' the project again. This corrected the sysroot directory reference in the make files to point to the new SDK and the error was resolved.
I've got the same problem. I was able to fix it by using a symbolic link.
This is what I made :
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
sudo ln -s MacOSX.sdk MacOSX10.07.sdk
Then enter your root password.
NB: you have to adapt the last line with required sdk.
For any one struggling with this on MacOSX Mojave this answer solves it. In short:
Go to the terminal and run open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg This will bring up the prompt to install Xcode tools.
After that's done got to the terminal and run sudo xcode-select -s /Library/Developer/CommandLineTools
My system is macOS Mojave, and I've fixed this problem by running this command line:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
It was caused by incorrect sysroot, (set for an older mac os version) set in makefiles.
If you are using CLion, follow these steps :
Click on CMake at the bottom center of your IDE
Click on the Settings Gear Icon at the left
Click on Reset Cache and Reload Project
Took me 3 hours to find this solution.
FYI this project was running fine on Bug Sur 11.3 but failed to build after I upgraded to Big Sur 11.4
Set an environment variable
SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"
and reopen Terminal. This solves the header not found issue.
To see where the compiler finds headers, run with -v
clang -v test.c
For my case, this problem result from that MacOS changes the headers's path.
Check this note: MacOS release note.
So the solution is to make the compiler can find those headers.
My macOS version is Catalina 10.15, and XCode Version 12.4. For this version, it seems that /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg is not provided anymore and thus the sulotions above do not work for me.
This method saved my night: Fixing C++ compilation bugs for the MacOS Catalina upgrade. Note that if you follow its steps and errors that some global symbols are not found arise, do not modify the LIBRARY_PATH as it says.
I did something dumb but it did fix the problem... Not sure if it will work for your computer though.
Here is what I did:
I originally installed c++ using Homebrew on my MacBook on Mojave... so I had to manually install the Xcode CommandLineTools using the installer found at /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg . Then I copied the "c++" folder contents from to folder /Library/Developer/CommandLineTools/usr/include/c++/v1 to the folder where I want the missing file to be, at /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0 , while replacing files with the same names.
The trick worked, since now the missing file "wchar.h" is right where it should be... Your settings is probably not the same, however, I am afraid.

Unable to compile openFrameworks

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

clang++: fatal error: 'unistd.h' file not found

Using OS X 10.10.2, I download Clang for Mac OS X v. 3.6.0, and try to compile a simple Hello World program.
The commands I use are these:
(assumes you downloaded clang to .)
cd .
./clang+llvm-3.6.0-x86_64-apple-darwin/bin/clang++ main.cpp
The result is this:
In file included from main.cpp:1:
In file included from ./clang+llvm-3.6.0-x86_64-apple-darwin/bin/../include/c++/v1/iostream:37:
./clang+llvm-3.6.0-x86_64-apple-darwin/bin/../include/c++/v1/__config:23:10: fatal error: 'unistd.h' file not
found
which makes sense, as there is no file unistd.h, as verifiable by
find . -name unistd.h
which yields 0 results.
I tried downloading the LibC++ source code v. 3.6.0 but even that contains no unistd.h. Where can I find the official/vanilla version of that file, and the files that are referenced, and meta-referenced, by it?
Clang does not include a c library or system headers, you'll need to install Xcode if you want to program on OS X. This page has some more details if you don't want to install the entire Xcode package, you can get away with the command line tools only.
Once you have Xcode / command line tools installed you can either use the versions of clang and gcc included with Xcode or the one you downloaded, although it's usually easier to use Macports or Homebrew if you're looking to use up to date versions of either.
That error disappeared after running xcode-select --install.
(I only keep HomeBrew's LLVM and clang regularly updated, so my original macos headers must have been ancient/non-existent until I used the above command to fix that.)
unistd.h is not a C or a C++ header! It is a POSIX header.
You could install XCode as it'll come from that, but I honestly don't know whether that'll be at all compatible with the Clang runtime. I'm not a Mac person.
Perhaps you can find an alternative; for example, there's no way you need unistd.h to compile a "Hello world" program!

Cygwin 64 G++ -fuse-linker-plugin Error

I am receiving the following error when I try to compile a very basic C++ program.
$ g++ -fuse-linker-plugin test.cpp
g++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
Code
int main() {
return 0;
}
This is using G++ installed straight out of a fresh Cygwin installation.
If I search for the file there, it does exist and is located at:
/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/cyglto_plugin.dll
How do I make Cygwin 64 look at this correctly?
I guess you only checked the gcc-g++ package at installation. Note that the version is 4.8.1-3 BUT on the next page you can see a lot of dependencies being installed, for example libgcc with version 4.8.2.
That mix of 4.8.1 and 4.8.2 seems to be the problem.
In the installer, copy all dependencies into an editor, search for 4.8.2 to find the problematic packages, go back in the installer and click those packages until 4.8.1-3 will be installed.
Double check you're not installing the latest version of those packages.
More recently using apt-cyg, g++ 4.9.2 was installed but gcc-core 4.8.2 remained.
Resolved by:
apt-cyg remove gcc-g++
apt-cyg remove gcc-core
apt-cyg install gcc-g++
Two version of gcc was causing proble, check folder /usr/libexec/gcc/x86_64-pc-cygwin/ there would be two version of gcc.
To solve remove one.
The above answer worked for me, but I got caught by the installer automatically upgrading packages back to 4.8.2. So, I initially thought this didn't work; it actually did. You just need to be aware of that when using the installer to add packages later, it may try to upgrade back to 4.8.2 again and break things.
There is the option to turn off LTO with -fno-use-linker-plugin, but that doesn't do me any good becuase CPAN is what is launching g++. It might serve as a workaround.
(I know this isn't much of an answer, but I was unable to comment)

Run Error With Qt Creator

I just downloaded and installed Qt Creator.
I have not messed with the PATH or any other settings.
But when I try to run a Qt GUI Application project, it gives the following error:
cc1plus.exe:-1: error: error: unrecognized command line option "-fno-keep-inline-dllexport"
The output says:
Error while building/deploying project ProjectFirst (kit: Desktop Qt
5.0.1 MinGW 32bit) When executing step 'Make'
I don't understand why this is happening. I looked it up online a lot before asking, but couldn't find anything.
I've just found the problem on my friend's computer the same as yours.
Type g++ --version to see what g++ is taking by default from your path.
If it is 4.4.* (<= 4.7.2) then found that old g++ and remove it to the trash.
Usually it goes with Perl package, needed by Qt configure.
Then return to Console and try g++ --version again
if it not 4.7.2 then lookfor old g++ again and remove it.
If it is written g++ : command not found or something like that - change your PATH variable.
Don't forget to reboot your computer after changing it.
When you got g++ --version with 4.7.2, look forward to having success.
Try to use nmake, not mingw32-make
The problem is that you are using the wrong mingw32 installation (an older version).
In order to solve this, check that the Kit you use has detected the correct Mingw version (this should be 4.7, which is located inside the qt installation tools directory).