SpiderMonkey 38 compilation error - c++

I was using Spidermonkey 24 earlier but then moved to version 38 yesterday. But the problem is I'm unable to compile any program using this version. I tried compiling the sample code that came within but it gives the following error:
sudo g++ -I /home/pi/mozjs-38.0.0/js/src/build_OPT.OBJ/dist/include/ -L /home/pi/mozjs-38.0.0/js/src/build_OPT.OBJ/dist/lib/ sample.cpp -o sample -lmozjs-38 -lz -lpthread -ldl
In file included from sample.cpp:1:0:
sample.h:6:21: fatal error: jscntxt.h: No such file or directory
#include "jscntxt.h"
^
compilation terminated.
Note: The path to that header is already specified in the command.
I was successfully compiling the program using the same command with spidermonkey24.
Thanks!

Related

I get "gcc.exe: fatal error: cannot execute 'cc1plus'" when I try to compile a program in C++ in Windows

I get the error "gcc.exe: fatal error: cannot execute 'cc1plus'" when I want to compile any program in C++. I didn't installed the compiler Mingw-w64, downloaded the zip from winlibs.com and I copied it to "C:". Then I added to the environment variable Path.
I tried to move the library cc1plus.exe.o to the lib folder of Mingw, and used the commands gcc test.cpp -o test.exe and gcc.exe test.cpp -o text.exe.
The OS is Windows.
Thank you.

Magick++.h header not found

I am trying to get g++ to compile a program that uses Magick++, however despite installing the libraries, I get the below error when compiling the program with g++ WallFade.cpp `Magick++-config --cxxflags --cppflags --ldflags --libs` -o WallFade:
fatal error: Magick++.h: No such file or directory
4 | #include <Magick++.h>
| ^~~~~~~~~~~~
compilation terminated.
When I set an absolute path to the header file by replacing #include <Magick++.h> with #include "/usr/local/include/ImageMagick-7/Magick++.h" I then get the following error:
/usr/local/bin/Magick++-config: line 47: --cflags: command not found
/usr/local/bin/Magick++-config: line 50: --cflags: command not found
/usr/local/bin/Magick++-config: line 53: --libs: command not found
/usr/local/bin/Magick++-config: line 56: --libs: command not found
In file included from WallFade.cpp:4:
/usr/local/include/ImageMagick-7/Magick++.h:10:10: fatal error: Magick++/Include.h: No such file or directory
10 | #include <Magick++/Include.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
I'm assuming I need to run some command to link the header files to g++, but I'm not sure what that command would be (currently running Arch Linux).
Install following package libmagick++-dev
packman -S libmagick++-dev
I think this is the way to install it on Arch.

Error message while compiling a program

I’m a newbie to C++ and Linux. There is this code I’m playing with that requires me to install the HElib (Homomorphic encryption library and other libraries - GMP, NTL) which I did. I want to compile the code (main.cpp) that has a header file (FHE.h) in HElib. My problem is how can I link FHE.h (in HElib folder) and main.cpp (in another folder) together so that I can compile them. I have tried some commands
g++ -I/Home/HElib/src/FHE.h main.cpp -o main
Error message
main.cpp:1:17: fatal error: FHE.h: No such file or directory
compilation terminated.
Another command line
g++ -I/Home/HElib/Src/FHE.h -I/Home/SimpleFHESum-master/SimpleFHESum-master/main.cpp -o main]
Error Message
g++: fatal error: no input files
compilation terminated.
What's wrong and how can I fix this?
The -I flag adds the following directory to the include path of the compiler. This enables you to write e.g. #include "FHE.h" even though that file is not located in the same folder as the source file you're trying to compile.
Have you tried just removing the 'FHE.h' part from your -I directive?
g++ -I/Home/HElib/src ...

Failing to compile GTest with Cygwin

I'm new to C++, I am trying to compile gtest with Cygwin. I have installed the GNU g++ compiler which works fine. I ran the following command on Cygwin:
g++ -I /cygdrive/c/devel/cpp/gtest/include -I /cygdrive/c/devel/cpp/gtest -pthread -c /cygdrive/c/devel/cpp/gtest/googletest/src/gtest-all.cc
/cygdrive/c/devel/cpp/gtest/googletest/src/gtest-all.cc:39:25: fatal error: gtest/gtest.h: No such file or directory
compilation terminated.
All the files seem to be in place, however the error does not go, any ideas why?
It looks like you have provided space between -I and path.
There should not be any space between -I and corresponding path.
It should be like
g++ -I/cygdrive/c/devel/cpp/gtest/include -I/cygdrive/c/devel/cpp/gtes..
Check it.

Boost header file linking error when I try to compile on Cygwin

I'm getting the error:
In file included from sourcefile.cpp:35:0:
myrandom.h:10:45: fatal error: boost/random/mersenne_twister.hpp: No such file or directory
compilation terminated.
when I try to compile my source file with:
g++ -o sourcefile sourcefile.cpp -I/cygdrive/c/Users/myname/Documents/Libraries/boost_1_55_0/ -L/cygdrive/c/Users/myname/Documents/Libraries/boost_1_55_0/libs/ -Wall -O0
I haven't had this problem before and everything was working fine. I'm not sure what's wrong and it's driving me nuts. Can you help me figure it out?