【问题标题】:c++ : run a simple code using Dev-c++c++ : 使用 Dev-c++ 运行一个简单的代码
【发布时间】:2016-04-05 14:35:14
【问题描述】:

即使我在 Dev-C++ 中运行一个简单的代码,我也会收到此错误消息,请帮助我解决问题!。

// Demonstration of variables
 #include <iostream>
 using namespace std;

 int main()
 {
 unsigned short int Width = 5, Length;
 Length = 10;

 // create an unsigned short and initialize with result
 // of multiplying Width by Length
 unsigned short int Area = Width * Length;

 cout << "Width:" << Width << "\n";
 cout << "Length: " << Length << endl;
 cout << "Area: " << Area << endl;
 return 0;
}

这是错误信息:

C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe  cannot open output file C:\Program Files\Dev-Cpp\MinGW64\bin\area.exe: Permission denied
C:\Program Files\Dev-Cpp\MinGW64\bin\collect2.exe   [Error] ld returned 1 exit status

【问题讨论】:

  • C:\Program Files\Dev-Cpp\MinGW64\bin\area.exe UAC 会阻止您将文件放在 C:\Program Files 中。看来你的输出文件夹是错误的。
  • 当您尝试在 C:\Program Files 中的任何位置写入时,通常会出现 UAC 问题。尝试将输出文件夹更改为其他位置。例如,我的文档下的文件夹通常是好的。
  • 我不认为您真的希望所有程序都被压缩到与编译器本身相同的文件夹中。

标签: c++ dev-c++


【解决方案1】:

在更合适的位置创建您的项目,例如“我的文档”。 “程序文件”是用于程序文件的。您的操作系统不会让您像这样在那里创建新的应用程序。这是违反安全规定的。

【讨论】:

  • inb4 是的,我知道他正在创建一个程序文件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-04-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多