mingw 编译运行c++ primer 例子时提示无法定位程序输入点怎么办?
#include <iostream>
int main()
{
int sum = 0, value = 0;
while (std::cin >> value) //此语句gcc编译报错
sum += value;
std::cout << "sum is: " << sum << std::endl;
return 0;
}
程序在vs2017上运行不出错,在notepad++用命令调mingw编译就会出如图的错,那个exe就是cpp文件编译的, mingw配置的问题?
notepad++配置
编译加运行
cmd /k g++ -o $(CURRENT_DIRECTORY)\$(NAME_PART).exe "$(FULL_CURRENT_PATH)" &cmd /k "$(CURRENT_DIRECTORY)$(NAME_PART)" & PAUSE & EXIT
mingw配置
MINGW_HOME=D:/MinGW
C_INCLUDE_PATH=%MINGW_HOME%/include
CPLUS_INCLUDE_PATH = %MINGW_HOME%\lib\gcc;
%MINGW_HOME%\lib\gcc\mingw32;
%MINGW_HOME%\lib\gcc\mingw32\6.3.0;
%MINGW_HOME%\lib\gcc\mingw32\6.3.0\include;
%MINGW_HOME%\lib\gcc\mingw326.3.0include\c++;
%MINGW_HOME%\lib\gcc\mingw32\6.3.0include\c++\backward;
%MINGW_HOME%\lib\gcc\mingw32\6.3.0\include\c++\mingw32;
LIBRARY_PATH = %MINGW_HOME%/lib
path里添加了%MINGW_HOME%/bin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
g++ 的args加上一句话"-std=c++11"试一试
补充,之前我发现MINGGW好像有些问题,还是建议你用Mingw-w64
可能是找不到共享库,把mingw lib加到环境变量里试一试