c++

background color for certain items(rows) in QFileSystemModel QTreeView

How do i set a custom background color for certain rows in a QFileSystemModel applied on a QTreeView? ...

g++ static library depends on dynamic libraries

I have some static library. for example libpuchuu.a it depends on dynamic library. for example libSDL.so (but of cource I have libSDL.a) Creation of libpuchuu.a is simple: ar -rcs object_file_1.o object_file_2.o But I can't link my project with libpuchuu.a! undefined references attack my console! At some forum I have found such sente...

Copy binary tree in order

The code I wrote so far is: void copyInOrder(TNode *orgTree, Tnode *& copyTree){ if(orgTree !=NULL){ copyInOrder(orgTree->left_link); //create leftmost node of tree but how to link to parent copyInOrder(orgTree->right_link); } } I dont know how to link to the parent to the nodes as its inorder. ...

is anybody doing anything about 2038 time_t bug?

Possible Duplicate: What should we do to prepare for 2038? I don't mean 'people' in the abstract. I mean are you doing anything and if so what? I am an ancient programmer and recall when I wrote COBOL in the late 70's saying to others in my team "you know - this isn't going to work in 2000". To which the reply was "yeah but t...

Brute-force, single-threaded prime factorization

Up for consideration is the following function which can be used to (relatively quickly) factor a 64-bit unsigned integer into its prime factors. Note that the factoring is not probabalistic (i.e., it is exact). The algorithm is already fast enough to find that a number is prime or has few very large factors in a matter of several second...

Sinking DWebBrowserEvents2 events appears to hang programmatic navigation

I posted this question on the MSDN forums, but my experience has been a better quality of answer here on Stack Overflow, so I'm posting here as well. As I've posted several times before, I'm working on a browser automation framework, automating Internet Explorer from an external process. My architecture is as follows: I have a server whi...

What is VC++ doing when packing bitfields?

To clarify my question, let's start off with an example program: #include <stdio.h> #pragma pack(push,1) struct cc { unsigned int a : 3; unsigned int b : 16; unsigned int c : 1; unsigned int d : 1; unsigned int e : 1; unsigned int f : 1; unsigned int g : 1; unsigned int h : 1; ...

Compiling QJson statically into Qt Application (multiple declaration errors)

Has anyone had success compiling QJson statically into an application? I am trying to use QJson statically in my Qt application (Windows/Mac), meaning I'm trying to use the source files directly rather than compiling a DLL and using it. Is this possible? My program is producing lots of errors when I attempt to do it, mostly "multiple dec...

Is -5 an integer literal?

[title] or is 5 a literal, and -5 is an expression with unary minus taking a literal as an argument? The question arose when I was wondering how to hardcode smallest signed integer values. TIA. ...

What's the best way to get started learning how to write an extremely simple multithreaded c++ program that includes mutex and semaphore use?

What package should I use and what would a "hello world"-level program look like? ...

GetOpenFileName Program-Defined Directory

I want to create a dialog box that resembles the one created with GetOpenFileDialog. However, I want the dialog to display a list of filenames that the program provides, and these filenames don't necessarily exist as files in a directory. The purpose is to provide a dialog with a similar look and feel for opening files, but rather inside...

Does g++ still generate an output file even if the program fails to compile/load?

I am compiling some C++ programs through a perl script using: g++ -o out `find ./ -iname "*.h" -or -iname "*.cpp"` This seems to generate an an out file every time, regardless of whether the program compiled successfully or not. Whenever the script tries to run programs like this, it gets permission errors (weird since I'm running as ...

Simplest WCF service to be consumed by C++

I'm a complete newbie regarding network stuff, but here are two scenarios I'd like to accomplish: I have a machine running a WCF service Scenario 1: on the same machine, I have a C++ app that needs to get data from that service Scenario 2: on a different machine, I have a C++ app that needs to get data from that service The data that...

How can I get the installed directory for a C++ Windows Service?

I have a C++ Windows service, and I would like to access an executable in the same directory as the service's executable (via the system function). I'd imagine to do this I'll need to find that directory, so that I can refer to the target executable's path. How can I find the directory in which the service is installed, in code? ...

c++ cpp conversion from 'myItem*' to non-scalar type 'myItem' requested

i have this code struc MyItem { var value MyItem* nextItem } MyItem item = new MyItem; And I get the error: "c++ cpp conversion from 'myItem*' to non-scalar type 'myItem' requested" Compiling with g++ Any ideas? Thanks! ...

Is it common for a language to evalute undefined as equal to false? If so, why is this done?

UPDATE: Question still unanswered. @Alastair_Pitts: Unless I'm missing something, it's a two part question. The second part, "If so, why is this done?" and not been answered. Believe the question is clear, but if you have any questions -- just let me know. Thanks! undefined = unknown and is a reference to system based on ternary logi...

How do I compile a simple c++ program that uses std::thread in cygwin?

#include < thread > results in: error: thread: no such file or directory How can I install/use this library? ...

Base class's function pointer points to child class's member function?

I know it sounds awefully confusing, I have a base template class which has a function pointer, a child class(which is no longer a template class) needs to use that function pointer to point to a child class's member function, and I get all kinds of errors.. Did I violate some universal law of C++? here is the pseudo code: template <cla...

Bad memory allocation C++ for a vector

I get std_bad_alloc error in the following code. It seems the problems is when I add the matrix to the vector, the program crashes when I get to that line in the debugger. The problem is that only the first two matrices are read from the file, the other two aren't because the program crashes with the above error. ...

Iterator for vector of pointers not dereferencing correctly

Here is my issue: I have a std::vector<AguiWidgetBase*> which is used to keep track of child controls. I have these two functions to return iterators: std::vector<AguiWidgetBase*>::const_iterator AguiWidgetBase::getChildBeginIterator() const { return children.begin(); } std::vector<AguiWidgetBase*>::const_iterator AguiWidgetBase:...