MinGW不会编译,错误1

MinGW不会编译,错误1

问题描述:

在c ++中创建一个简单的hello world应用程序,但它不会编译。我有文件 C:\WiiGames\e3\ 的文件 main.cpp Makefile 。我的makefile是:

Making a simple hello world app in c++, but it won't compile. I have the folder C:\WiiGames\e3\ with the files main.cpp and Makefile. My makefile is:

build: main.cpp
    C:/MinGW/bin/g++.exe main.cpp -o e3.exe

我的错误是:

C:\WiiGames\e3>make build
C:/MinGW/bin/g++.exe main.cpp -o e3.exe
make: *** [build] Error 1

C:\WiiGames\e3>

任何帮助将非常感激。

我的代码:

#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <cstdlib>
#include <time.h>

int main() {
    printf("Hello World!");
}

g ++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)


当你在命令行上直接运行 g ++。exe main.cpp -o e3.exe 时?如果没有发生,是g ++在你的路径?我将首先确保g ++设置和你的路径。

What happens when you run g++.exe main.cpp -o e3.exe on the command line directly? If nothing happens, is g++ in your path? I'd start by making sure that g++ is setup and in your path.