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: Enter image details here

But when I run main.exe, I get this Is: Enter image details here

And if I'm the main.exe as an administrator I get it when I run:  Enter image details here

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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -