I have some experience with multithread programming under Linux (C/C++ & POSIX threads), however most obvious cases are sometimes very complicated.
I have several static constant variables (global and function local) in my code, can I access them simultaneously from multiple threads without using mutexes? Because I don't modify them it ...
I am running producer consumer problem( using windows thread ).It compiling successfully but on running it showing following error
The procedure entry point InitializeConditionVariable could not located in the dynamic library Kernel32.dll.
can u tell what would be reason
...
My code:
#include <string>
#include <boost/algorithm/string/regex.hpp>
std::cout << boost::algorithm::replace_regex_copy(
"{x}{y}", // source string
boost::regex("\\{.*?\\}"), // what to find
std::string("{...}") // what to replace to
);
This is what I see:
{…}{y}
Thus, only the first occurrence replaced. Why? How to so...
stringstream parser;
short top = 0;
parser << 5;
parser >> top;
parser.str("");//HERE I'M RESETTING parser
parser << 6; //DOESN'T PUT 6 INTO parser
short bottom = 0;
parser >> bottom;
Why doesn't it work?
...
Hi All.
I've a VS2008 native C++ project, that I wish to compile as a DLL.
It only references one external library (log4cplus.lib), and uses its functions.
(also uses log4cplus's .h files , naturally).
When I try to compile my project as a static library, it succeeeds.
When I try as DLL, it fails :
1>MessageWriter.obj : error LNK2019...
I'm developing a Qt application. For each class, I'm trying to mimic the framework, such as error() and errorString() method, use of Private implementation.
But I would like to add a per class debugging:
Set a macro to the desired level of debug,
have a macro or a function that knows the level of debug, and use qDebug() or qWarning()...
I'v looked on MSDN and can't find how to do this. It lets me set the range and position but not the thumb that the user clicks and drags.
Thanks
...
I have the following:
class DThread
{
virtual void run()=0;
_beginthreadex(NULL,0,tfunc,this,0,&m_UIThreadID); // class itself being passed as param to thread function...
static unsigned int __stdcall tfunc(void* thisptr)
{
static_cast<DThread*>(thisptr)->run();
return 0;
}...
I'm still learning C++, so bear with me and my sloppy code. The compiler I use is Dev C++. I want to be able to output Unicode characters to the Console using cout. Whenver i try things like:
# #include directive here (include iostream)
using namespace std;
int main()
{
cout << "Hello World!\n";
cout << "Blah blah blah some ...
Hi,
The situation is this. I would like to catch mouse and keyboard events in html code which loaded using Mozilla embedded.
IS there support for it?
Thanks.
...
Hello,
I'm looking for a library which could rank/unrank ordered combinations
(ranking means from a combination it give you which nth combinations it is from a gray code or lexicographic or some other algorithm, unranking is the reversing process).
I look for a library doing many algorithmes like gray code or lexicographic, rev-lexico...
I have a pretty standard Qt GUI application. It uses Qt's QSettings to store a number of settings, and it all works fine.
However, when multiple copies of the application are launched, and settings are changed in one or the other, the different copies can appear inconsistent (as one has the "old" copy of the data).
What are the prefer...
Hello,
Im trying to run sample app from wxFreeChart library. After compilation on linking there is an error:
wxcode_msw28d_freechart.lib(wxfreechart_lib_xydataset.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
I tried to switch linker option\advanced\target machine to MachineX64 but it d...
I was looking at an example of reading bits from a byte and the implementation looked simple and easy to understand. I was wondering if anyone has a similar example of how to insert bits into a byte or byte array, that is easier to understand and also implement like the example below.
Here is the example I found of reading bits from a ...
Does the standard specify the official C++ grammar?
I searched, but did not find it anywhere.
Also, I wish to read a bit about C++ grammar in detail, like which category of grammars it falls in, etc. Any links pointing me in the right direction would be helpful.
By category, I mean
taken from here.
...
Hi all,
I am working on Ubuntu 9.10 aka Karmic Kola and latest version of gcc, Qt 4.6.2. I have installed the french fonts and hindi fonts for ubuntu. I changed the language and Keyboard layout accordingly so that I could type in the abovementioned languages. It worked fine. I then made a sample application and added appropriate transla...
In the sake of debugging purposes, can I get the line number in C/C++ compilers?
(standard way or specific ways for certain compilers)
e.g
if(!Logical)
printf("Not logical value at line number %d \n",LineNumber);
// How to get LineNumber without writing it by my hand?(dynamic compilation)
Thanks
...
Is it possible to get a raw pointer from boost::weak_ptr? Boost's shared_ptr has get() method and "->" operator. Is there some rationale behind weak_ptr not having the same functionality?
...
struct t_empty {
};
This appears to compile properly in C++ but not C. (at least with the TI 28xx DSP compiler, where it emits the error "expected a declaration") Is this mentioned somewhere in the C standards, or is my compiler broken?
...
According to the documentation, a boost::thread::id can be considered unique for each running thread and can be used in containers such as std::set and std::map (because the < operator is overridden for thread::id).
My problem is that I'd like to use thread::id as a key to an boost::unordered_map, however it requires that the key is "ha...