I tried to use Boost thread local storage with Windows threads. I built the project without any problems.
However my question here is, is it okay to use Boost TLS with Windows threads?
Edit
Yes Boost is integrally supported on windows with all major compilers:
Supported compilers and platforms
The library should build and work with a reasonably compliant compiler. The library was > successfully built and tested on the following platforms:
Windows XP, Windows Vista. MSVC 8.0, 9.0. MSVC 7.1 may work too, but it was not tested.
Windows Vista. Intel C++ Compiler 10.1.022, 11.1.048.
Linux. GCC 4.2 and newer. GCC 4.1 may work too, but it was not tested.
Linux. Intel C++ 11.1.056.
The following compilers/platforms are not supported and will likely fail to compile the library:
MSVC 7.0 and older.
Borland C++ 5.5.1 (free version). Newer versions might or might not work.
GCC 4.0 and older.
Windows 9x, ME, NT4 and older are not supported.
I suppose you mean what "libraries do I need"?
You need to link to the import library for boost threads, usually a file like
C:\Program Files\boost\boot_1_47_0\lib\libboost_pthread....lib
This file can be added to the additional libraries to link box in the c++ linker settings. Don't forget to add it for debug and release builds.
PS. don't have Windows handy right now, so I can't do the screen shots.
Related
I would like to ask a question about VS2010 IDE environment with all the C++11 features. Currently we need to build our software where some libraries need C++11 all feature support but we are now still running VS2010 environment and currently we are not upgrading our VS2010 to VS2017 at this moment.
So Is there any way to build these library with alternative mentods like installing QT creator on Windows platform so that can use g++ 4.9.3 or later same as on linux ubuntu? I found some website mentioning about Cygwin installed on Windows but seems not clear how to do.
Thanks for your help!
The QT installer provides binary versions built with MinGW as well as MinGW itself, so just use those.
I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error:
clang++.exe: error: Unsupported CUDA gpu architecture: compute_52
This makes no sense to me because I have the CUDA toolkit version 7.5 and my graphics card is a GTX 970 (two of them). I have googled this extensively and everywhere I come across the error the person always has is their CUDA toolkit is < 7.5. I'm on the brink of tears right now trying to get something as simple as VLA to work on this CUDA application and I just can't achieve it...
The CUDA windows toolchain requires the Visual Studio C++ compiler. You cannot use anything else on that platform. If the VS compiler doesn't support the language features you need within CUDA host code, you have no choice but to change platforms, or your expectations.
You can still potentially compile non-CUDA host code using another compiler and then link that code using NVCC and the VS toolchain.
Try to use clang-cl, --cubin=clang-cl.exe
It may be worth to work on a Linux VM or WSL2 within windows. As per the CUDA docs.
To compile new CUDA applications, a CUDA Toolkit for Linux x86 is
needed. CUDA Toolkit support for WSL is still in preview stage as
developer tools such as profilers are not available yet. However, CUDA
application development is fully supported in the WSL2 environment, as
a result, users should be able to compile new CUDA Linux applications
with the latest CUDA Toolkit for x86 Linux.
https://docs.nvidia.com/cuda/wsl-user-guide/index.html#:~:text=However%2C%20CUDA%20application%20development%20is,becomes%20available%20within%20WSL%202.
At work we develop software that uses java7 and C++03, I would like to get my team to replace c++03 and instead embrace C++11. Can I assure them that every OS that runs java7 has also a gcc compiler for C++11?
I know the relation I make between java7 and c++11 is somewhat weird, but that's my way of saying we need to support some old OSes, but not that old that they don't run java7.
Thanks
It depends on whether you follow the sys specs for java 7 or not. There might be a way to force it to run on earlier versions of the mentioned OSs, but it is not officially specified so. take a look at the requirements:
Java 7 & 8 Sys Req
Now, for the listed OSs I am sure that GCC 4.7.2 is available (or it can be compiled). For windows, MS provides support for C++11 starting with VS 2010 which runs on Win XP or newer (if you don't like something like Cygwin).
The problem with all this is that it depends on how many C++11 features you actually need. For instance, Visual Studio 2010 doesn't support all C++11 features. Take a look at the following table to see what is supported in each compiler:
C++ compiler support
I'm kind of lost with all these SDK windows versions.
For instance, I installed vs2013 on windows8.1, and I (also) need to link my apps against vs2008 runtime (platform toolset).
Should I install the whole VS2008 too or just the API. In the last case, what SDK do I have to install ?
You are talking about two very distinct things. The Windows SDK only covers the declarations and libraries that you need to make winapi calls. SDK v8.1 is suitable to target any modern Windows version since Vista, you select the Windows version you want to target by setting the _WIN32_WINNT macro. Note that XP requires an older SDK version, v7.1 is the last one that's still suitable and selected by setting the Platform Toolset to v120_xp.
The runtime libraries are a pure implementation detail of Visual Studio C/C++ projects and completely unrelated to the SDK. When you build such a program on VS2013 with the /MD compile option then it will have a dependency on msvcr120.dll, possibly msvcp120.dll and others. These DLLs implement the C runtime library and the C++ standard classes. And possibly MFC, ATL, OpenMP and AMP if you use those libraries.
If you still have a dependency on the VS2008 version of those libraries then you are liable to have a Really Big problem. You can obtain the release versions of those DLLs from the redist installer you can download from Microsoft. Having a dependency on the debug version requires having VS2008 installed on your machine. But having trouble linking the program and misery at runtime is highly indicated, the runtime libraries changed a great deal between VS2008 and VS2013 thanks to the new C++11 language standard. Having more than one CRT in a program is in general liable to cause lots of trouble.
You need to strongly pursue getting the library that still has the VS2008 dependency rebuilt. Contact the owner of the library if necessary to get an update.
I'm currently studying a book regarding C++, which is quite new. Therefore it also discusses C++11 in some parts. Having Windows Vista, I can't download the latest version of Visual Express, so I'll have to do with the 2010 version. This doesn't support C++11, so I'm currently wondering whether there exists a free alternative which does support C++11.
p.s. - Would you say it's essential/important for a beginner in programming to learn C++11 as well (instead of just the core basics)?
You could consider using virtual machine with a Linux flavor. I had the same problem as you, I installed VirtualBox, then Ubuntu having the latest g++ compiler
You could compile and use Clang on Windows Vista and integrate it to Visual Studio. They have an almost complete support for C++11 now (as of version 3.3).