1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Rep Power

    Exclamation [DevC++] Array Script not works, error found!

    Hey C++ Programmers,

    I try to write an script just you can call the array number (Aperatures[0], ..., Aperatures[9]) to print
    his numbers... So this is my script, writted in Dev C++....

    The Script:
    #include <iostream>
    using namespace std;
    int main() {
    	int Aperatures[10];
    	int j;
    	Aperatures[0] = 1;
    	Aperatures[1] = 2;
    	Aperatures[2] = 3;
    	Aperatures[3] = 4;
    	Aperatures[4] = 5;
    	Aperatures[5] = 6;
    	Aperatures[6] = 7;
    	Aperatures[7] = 8;
    	Aperatures[8] = 9;
    	Aperatures[9] = 10;
    	while (j < 9) {
    		cout << "Stapel: ";
    		cin >> j;
    		for (int i = 0; i < j; i++) {
    			cout << "Aperature" << Aperatures[i] << endl;
    	return 0;
    But if i run my script, i get an error thad sey the follows:

    Error i get:
    Compiling single file...
    - Filename: C:\Users\Gebruiker\Desktop\arrtest.cpp
    - Compiler Name: TDM-GCC 4.9.2 64-bit Release

    Processing C++ source file...
    - C++ Compiler: C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe
    - Command: g++.exe "C:\Users\Gebruiker\Desktop\arrtest.cpp" -o "C:\Users\Gebruiker\Desktop\arrtest.exe" -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\include" -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include" -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include" -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++" -L"C:\Program Files (x86)\Dev-Cpp\MinGW64\lib" -L"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib" -static-libgcc
    C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file C:\Users\Gebruiker\Desktop\arrtest.exe: Permission denied
    collect2.exe: error: ld returned 1 exit status

    Compilation results...
    - Errors: 1
    - Warnings: 0
    - Output Filename: C:\Users\Gebruiker\Desktop\arrtest.exe
    - Output Size: 1,83212089538574 MiB
    - Compilation Time: 1,08s

    I get an question for the follows: how can i understand the syntax error i get, as this error:
    error: ld returned 1 exit status
    So, if i understand this, i hope i can fix this problem for the next case....
    Just can anyone correct my code and learn my to understand the type error i get ?,

    Thanks, Jamie.
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power
    There's no syntax error. Look at the message more carefully:
    cannot open output file C:\Users\Gebruiker\Desktop\arrtest.exe: Permission denied
    "Permission denied" does not mean necessarily you don't have permission but rather that it was not possible. Was the program still running when you tried to recompile? In use by something?

    Besides that,
    - Output Size: 1,83212089538574 MiB
    Really? Did it really say that? I'm not sure if that's funny or stupid.
  4. #3
  5. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    You're using windows, and you must close the currently running program before the compiler overwrites the existing .exe with the new file.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo