clang support for exceptions on windows xp - windows

I would like to use clang for c++ development (windows for now but, linux, android etc...), and so far for the past 6 months I was able to compile quite complicated code with little issues. But couple of weeks ago I stumbled on the problem with exceptions not being handled. I researched and read anything i could find but i still don't have definitive answer if it is possible to use exceptions with any combination of mingw/g++/llvm/clang.
The closest leads so far seem to be ruben's builds, but I can't get them to work due to another known problem - strerror_s.
The minimal code i am trying to make work is quite simple:
int main()
{
try { throw 0; }
catch(...) { return 1; }
return 0;
}
Any help will be greatly appreciated because i have stopped my work and am struggling to get the exceptions going.
Thanks,
Orlin++

I'm sorry you're having trouble with my builds. I must admit Windows XP isn't high on my priority list...
What you can try is to build clang 3.2 yourself using the GCC dw2 toolchain on Windows XP, so that the problematic strerror_s function is not used. This is something that only affects the clang binaries, not any binaries that they produce.

Related

Is that a bug in Qt Creator analizer

While working with some code I experienced QT Creator performance degradation. Actually it launches a thread that occupies 100% CPU in an infinite loop: even closing the IDE process without killing it becomes impossible. This is fully reproducible on my machine. Before submitting a bug I wish to get a confirmation from other users and to collect some statistics for the versions of QT Creator, OS, compiler, STL, etc. The code requires C++11 and higher.
After some investigation I reduced my code to the shortest sample that reproduces the issue (don't look at the symantics of the code, the problem is in how does the IDE treats it):
#include <set>
int main() {
std::set<int> s;
auto iter = s.insert(1).first;
iter->second;
return 0;
}
The highlights:
auto is important
the same behavior can be reproduced with the map instead of the set
insert is important as it returns not a simple iterator but a pair< iterator, bool>
The line iter->second is symantically incorrect, but that is not important (you may use std::set< std::pair> to make it correct). The problem is that the IDE crashes after iter-> whatever it could mean.
My configuration is: QT Creator 3.5.1 based on Qt 5.5.1 (MSVC 2013, 32 bit); Windows 10.
A lot has happened since Qt Creator 3.5. The code model is completely new, based on Clang. Hence, I cannot reproduce your problem with Qt Creator 4.9. (And yes, the old code model had several limitations and bugs.)
In general, always make sure you have the latest supported version of the software before you prepare a bug report.

CLion syntax error issues with opencv/armadillo

I am using CLion to do C++ development on Mac OS. It's a great IDE with many cool features, but I find the syntax error highlighting feature doesn't work well with matrix libraries like armadillo/opencv.
I installed the libraries via brew, and I am using Apple clang toolchain. However, CLion is showing too many distracting syntax errors incorrectly, even though the program compiles perfectly fine with cmake. Is there a way to solve this issue?
Below is a screenshot of the one of the "errors":
It's a perfectly ok opencv mat constructor with MatExpr, but somehow CLion doesn't find the right function defintion.
I can provide more details if needed. If nothing else works, I think a way to quickly toggle showing/hiding the errors would work for me as well, but I haven't figured that out yet either.
Thanks in advance!

Qt Creator with MinGW or Visual Studio - Which one is "faster"?

I've been using Qt Creator for about a year. Because I was new to it and was trying to get things up and running as quick as possible, I opted for the MinGW compiler. My projects have worked well enough, but I am working on one that processes a lot of data but is nonetheless processing much slower than hoped.
Before I undertake the task of installing MSVS, are there any thoughts on whether a switch to the MSVS compiler on Windows 7 generally produces a "faster" exe?
I realize there are subjective elements to this question, but I just want some general ideas.
Ages ago, the Qt-msvc2010 builds were faster than MinGW.
It depends which Qt version, which MSVC version etc you're comparing, how you include headers, etc.

Boost Fiber on OS X

I'm trying to get boost fiber up and running on os x, and I'm having quite a few issues. First, fiber won't compile with Apple clang because of the use of thread_local which Apple does not support (according to what I found online, they think they can implement it better than standard llvm and don't want to introduce it only to break ABI later).
So instead, I tried using gcc-5 installed through homebrew. After a bit of screwing around with boost build I managed to get fiber to build, and I can link sample programs successfully, but they seg fault.
Then I figured I'd give current llvm a try, since it has thread_local support, and I can again get boost fiber to build fine, but now I'm getting issues because the os x linker doesn't seem to handle thread local properly either! I would post the exact error, but my power is out. I did actually get it to link though with a couple changes to fiber, but the sample program failed again.
So the question is, how can I make this happen? Is there any way to get another linker working to produce os x executables for me? Llvm comes with another linker called lld, but I don't think it does what I'm after.
I think if I absolutely had to, I could go through fiber and boost context replacing all thread_local with boost::thread_specific_ptr, but I'm not sure how deep that rabbit hole goes. Any suggestions?

how to obtain VC++ compiler-style help on GCC G++ compile/link errors (on linux)

I'm using VC++ as professional developer for more than 10 years and it has been good to me, now I'm trying to broaden my horizons and learn C++ development on Linux.
On Windows things are simple, VC++ does it all (editing, project management, help, debugging), but on linux things are different, you have assemble your development environment from different tools.
I'm still trying to tie things together, and one thing I still haven't figured out is how to decipher GCC (G++) errors when compiling/linking C++ apps on Linux (although I realize GCC is multi-platform, I'll refer to my linux experience here only).
In VC++, things are very clear: If during compilation VC++'s compiler encounters error in program, it will create new entry in 'output' window with the 'compiler error ID'. Example:
c:\projectA\fileB.cpp(38) : error C2228: left of '.cout' must have class/struct/union
From here, you can click on the line in question in 'output' window, press F1, and 'Microsoft Document Browser' app will start (if it wasn't started already), which will load MSDN help file describing compile error connected to the compiler error ID (in example it's C2228), usually with sample you can check out to figure out what's wrong with your code. If you don't have MDB installed, you can always search on the web for C2228 and get the same help page, optionally finding other people's web pages describing their experience with this error.
The same thing is with linking, you'll get 'linker error ID' (e.g. LNK1123), which you can use to find help either locally or on web.
Try as I might, I can't find this kind of functionality in GCC's G++. All I can see is bunch of less experienced GCC developers asking another bunch of more experienced GCC developers to analyze their code based on descriptive compiler/linker errors with no associated error IDs.
Is there tool(set) that provides VC++ compiler-style help on GCC G++ compile/link errors for linux?
You may try to use qtcreator. At least it can show the errors in a more comprehensive way comparable to the VC++, that is, it can locate the error position and highlight the error line and variables.
If you can an alternative might be to use Clang instead. It gives much better error messages than g++. It compiles most code these days (but it still a work in progress). Highly recommended.
Alternatively (as another poster has mentioned) you could use an IDE such as Eclipse to capture the error messages, though I don't think that adds anything beyond taking you to the line number on double-click.

Resources