I used a sample code from mathworks website to integrate a MATLAB code with C/C++ by a link!
As you seen in the code, there is header file as:
#include "engine.h"
In Linux (Ubuntu), I ran:
g++ engdemo.cpp -o mycpp command to create an executable program, but the below fatal error occurred:
engdemo.cpp:14:20: fatal error: engine.h: No such file or directory, compilation terminated.
How can i solve this fatal error?
Look in
[matlabroot '/extern/include']
If you see engine.h there, just run
g++ -I../../include engdemo.cpp -o mycpp
(assuming you run from [matlabroot '/extern/examples/eng_mat/'])
Related
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.
So here's my problem. I have downloaded mingw g++ by using msys according to the official vs code website
Here are my files:
Now, when I try to build I get this error:
> Executing task: g++ -std=c++14 -g -o myfile.exe myfile.cpp <
cc1plus.exe: fatal error: myfile.cpp: No such file or directory
compilation terminated.
The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command g++ -std=c++14 -g -o myfile.exe myfile.cpp" terminated with exit code: 1.
And if I do have a .exe file:
edit: I also started getting errors with
#include <iostream>
I would make this a comment if I could. What is the name of the file where you have written #include <iostream>?* I think if you change the name of that file to "myfile.cpp", you might stop getting that error. You will probably get a different error saying that "main() cannot be found" or something like that, but that's an improvement from your current spot.
*I see it's O3.cpp. Try changing that to myfile.cpp.
I can't compile the SSDL source code from the book C++ for the Lazy Programmers (2019) by Will Briggs on my ubuntu 20x so could you please tell me what goes wrong? I installed SDL2 and it's working but most of the cases I get the following error when I compile an SSDL code;
cpp-for-lazy-programmers/ch1/hello$ make -f Makefile.unix
g++ -c -g sdl2-config --cflags -I…/…/external/SSDL/include main.cpp -o main.o
In file included from …/…/external/SSDL/include/SSDL.h:27,
from main.cpp:7:
…/…/external/SSDL/include/SSDL_display.h:28:10: fatal error: SDL_ttf.h: No such file or directory
28 | #include <SDL_ttf.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile.unix:60: main.o] Error 1
I just can't understand why SDL_ttf is a big issue as I see many posts regards to SDL_ttf?
Just because they both have "SDL" in the name does not mean they are part of the same library.
If you search for SDL_ttf.h on packages.ubuntu.com ("contents of packages"), it will tell you that you want the libsdl2-ttf-dev package
This is also mentioned in the accompanying documentation.
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 ...
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?