I built and ran the attached code with a thread as C++11 and it works except for if I use the Windows console, the NetBeans output window says "RUN FAILED (exit value -1, total time: 5s)" after I enter the number of values to sort. It runs to completion OK and debug seems to work ok regardless of this.
If I use Standard Output, I get no run failed message.
Also attached is a screenshot of the build tool versions.
CODE:
#include <iostream>
#include <iomanip>
#include <thread>
using namespace std;
int arrayVals;
int arr[10];
int minIndex, tmp;
int i = 0;
void PrintArray(int a[], int size) {
for (int i = 0; i < size - 1; i++)
cout << setw(2) << a[i] << ", ";
cout << setw(2) << a[size - 1] << endl;
}
void f() {
cout << "This program sorts a set of up to 10 numbers." << endl;
do {
cout << "How many numbers do you want to sort? ";
cout << endl;
cin >> arrayVals;
} while (arrayVals > 10);
cout << "Enter the " << arrayVals << " values: ";
cout << endl;
while (i < arrayVals) {
cin >> arr[i];
i++;
}
cout << endl;
for (int j = 0; j < arrayVals - 1; j++) {
minIndex = j;
for (int k = j + 1; k < arrayVals; k++) {
if (arr[k] < arr[minIndex]) {
minIndex = k;
}
}
if (minIndex != i) {
tmp = arr[j];
arr[j] = arr[minIndex];
arr[minIndex] = tmp;
PrintArray(arr, arrayVals);
}
}
}
int main() {
std::thread t(f);
t.join();
}
On Tuesday, October 14, 2014 11:18 PM, Mark Wilmoth <mark.wilmoth-***@public.gmane.org> wrote:
I wrote thos instructions for MSYS2/MinGW-w64. I just installed it and it works with a simple project that sorts a few numbers. (Even with the MSYS2 MinGW-w64 builds) It works with the project set to C++11. Debug seems to work on it. I would need to try a C++11 project with C++11 features I suppose to see if there are problems with it, but I don't know C++ well enough and don't have time to work with it. If I had a C++11 sample project using threads, I could try it.
The NetBeans 8.0.1 v1.1 patch released Oct. 9th has some C++11 related fixes in it [1].
[1] https://netbeans.org/bugzilla/buglist.cgi?status_whiteboard=801patch1&status_whiteboard_type=allwordssubstr
Post by DarioOliexcept the fact neabeans refuse to use that by checking version number
Are you sure? http://wiki.netbeans.org/HowToCreate64-BitC/C++WindowsProgramWithNetBeans#Installing_MinGW-w64_.26_MSYS2