Dev Shed Forums - C Programming http://forums.devshed.com/ C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems. You can also talk about C# implementation in our .NET section below, when applicable. en Thu, 21 Jun 2018 21:07:08 GMT vBulletin 60 http://forums.devshed.com/images/misc/rss.png Dev Shed Forums - C Programming http://forums.devshed.com/ <![CDATA[[DevC++] Array Script not works, error found!]]> http://forums.devshed.com/programming/980675-devc-array-script-error-found-new-post.html Thu, 24 May 2018 18:33:02 GMT ]]> 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:
Code:

#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:
Quote:

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:
Quote:

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. ]]>
C Programming JamieVanCadsand http://forums.devshed.com/programming-42/devc-array-script-error-found-980675.html