g++ does not make any file or give any output

狂风中的少年 提交于 2020-12-06 15:37:39

问题


I've just started using g++, downloading the latest version from the site, and I've made a simple HelloWorld program.

#include <iostream>
using namespace std;
int main()
{
  cout << "Hello World!" << endl;
  return 0;
}

When I try to execute using the powershell window and g++, in the right directory, I use the following command:

g++ HelloWorld.cpp -o HelloWorld.exe

This gives no output and makes no files. I used the -v command as per some other answer I read on the site and it gave me this. I don't know how to proceed and execute my program.


回答1:


I've had the same issue and, after running it with the traditional batch console instead of powershell, I noticed a dll was missing. The dll error won't pop up in the powershell command line (god only knows why).

In my case it was libisl-15.dll, but it may be different on your PC.

Hope this helps someone in the world!




回答2:


Command

 g++ HelloWorld.cpp -o HelloWorld.exe

does not execute propgam, it just build executable file HelloWorld.exe.

So, after g++ HelloWorld.cpp -o HelloWorld.exe check the appearance of HelloWorld.exe file. If it is, just run it like:

 .\HelloWorld.exe


来源:https://stackoverflow.com/questions/45392444/g-does-not-make-any-file-or-give-any-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!