Discussion:
NetBean.C++11 clean setup with MSYS2
DarioOli
2014-10-12 16:21:22 UTC
Permalink
Using Netbeans without latest mingw-builds/MSYS 2 is almost useless. No one considered updating the package?
(and maybe providing a all-in-one installer? )
soldatov
2014-10-12 20:37:46 UTC
Permalink
Post by DarioOli
Using Netbeans without latest mingw-builds/MSYS 2 is almost useless.
Why? Standard MinGW (http://sourceforge.net/projects/mingw/) uses new GCC 4.8.1 and contains MSYS 1.0 package. Which sense in MSYS 2?
DarioOli
2014-10-14 12:10:23 UTC
Permalink
There are various reasons:

std::thread missing & other threading features missing
-http://mingw.5.n7.nabble.com/C-11-thread-support-in-4-8-1-td33129.html

code bloat.
mingw project add about 0.5MB for each compile unit that includes "iostream" while mingw-builds provides dlls to reduce code bloat from STL containers

also, MSYS 2 basically provide same functionality (except the fact neabeans refuse to use that by checking version number)

People using threading features of C++11 is using

MinGW-builds
XOR
MinGW-w64

both of wich are not the recommended package for Netbeans.

Also developers there reccomend MSYS 2.0:

http://sourceforge.net/p/mingwbuilds/mailman/message/32876748/

enough to bring attention of netbeans developers here?
soldatov
2014-10-14 12:28:56 UTC
Permalink
Post by DarioOli
except 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
Mark Wilmoth
2014-10-15 04:17:48 UTC
Permalink
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 DarioOli
except 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
Mark Wilmoth
2014-10-15 05:58:56 UTC
Permalink
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 DarioOli
except 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
soldatov
2014-10-15 07:13:05 UTC
Permalink
Post by Mark Wilmoth
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.
You main() function has not 'return'.'return 0;' will fix your "problem" with Windows console.
Mark Wilmoth
2014-10-15 09:26:53 UTC
Permalink
I still get "RUN FAILED" in the NetBeans output window while the program is still running in the Windows console waiting for the numbers to sort to be entered. It even does it on a single thread code like:

CODE:

#include <iostream>
#include <iomanip>

using namespace std;

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;
}

int arrayVals;
int arr[10];
int minIndex, tmp;
int i = 0;

int main() {
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);
}
}

return 0;
}
Post by Mark Wilmoth
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.
You main() function has not 'return'.'return 0;' will fix your "problem" with Windows console.
soldatov
2014-10-15 09:34:27 UTC
Permalink
Can you check this code too:

Code:

#include <unistd.h>

int main(int argc, char** argv) {
sleep(30);
return 0;
}
Mark Wilmoth
2014-10-15 17:22:00 UTC
Permalink
Yes, after 5 seconds, the NetBeans output windows shows "RUN FAILED (exit value -1, total time: 5s)".

Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Updates: NetBeans IDE is updated to version NetBeans 8.0.1 Patch 1.1
Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\MackSix\AppData\Roaming\NetBeans\8.0.1
Cache directory: C:\Users\MackSix\AppData\Local\NetBeans\Cache\8.0.1

Mark
Can you check this code too:

Code:

#include <unistd.h>

int main(int argc, char** argv) {
sleep(30);
return 0;

}

Loading...