dimanche 3 février 2019

Eclipse C++: Running programm with MingW + Toolchains

I am having troubles installing a c++ compiler, I am not sure if I installed everything correctly, after following an instruction guide from my professor and I have a few questions about the IDE.

When the compiler shows an error, it does not show the line, only the problem and I do not know what happens if there are multiple problems. Is it possible to see the line, where the problem occurred ?

I am using MingW to run the code. As a toolchain, I use MinGW GCC and as Current Builder CDT Internal build.

Would this code compile normally?

#include <iostream>
using namespace std;
using std::cout;
using std::endl;
using std::cin;

int main() {

int a = 100;

do
{
    cin >> a;
    if(a < 0)
        cout << "negativ" << endl;
    else if (a > 0)
        cout << "positiv" << endl;
        else
            cout << "null" << endl;
}while( a != 0);
return 0;
} 

Also, sometimes I receive this error.

C:/Program Files (x86)/mingw-w64/i686-7.1.0-posix-dwarf-rt_v5- 
rev2/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.1.0/../../../../i686-w64- 
mingw32/bin/ld.exe: cannot open output file Uebungsblatt_4V1.exe: Permission 
denied
strong textcollect2.exe: error: ld returned 1 exit status

`

Aucun commentaire:

Enregistrer un commentaire