c++ - How to create a working makefile for a .cpp file -
I am trying to figure out how to work Messief for my CPP file
Here is the code for Main.cpp:
#include & lt; Iostream & gt; using namespace std; Int main () {cout & lt; & Lt; "Hello world!" & Lt; & Lt; Endl; Return 0; } Here is my code for creating the file: all: main.exe
main.exe: main.og ++ -o main.exe Main .o main.o: main.cpp g ++ -c main.cpp When I enter the "make" command
I get this:
But when I run main.exe, I get this Is:
And if I'm the main.exe as an administrator I get it when I run:
Your makefile looks ok though, That you are compiling the linux machine on the linux machine. If this is true, then your problem is. Running Linux on G ++ will target Linux. Just adding .exe to your file name it will not be compatible with Windows.
There are tutorials for compiling Linux on Windows, or you can install the proper compiler on your Windows machine, or just run the compiled program inside the Linux environment.
Comments
Post a Comment