c++

Preventing a complete rebuild using branches with GIT and Visual Studio 2005

One of the problem I faced when using branches in GIT was that it was very easy when switching branches to cause visual studio 2005 to cause a complete rebuild of the source because of the time/date being changed when switching branches. My typical layout is this. svn/remote master test When switch between either the test and the maste...

Namespaces with external linkage

The problem I have is basically the same as 'greentype' mentions at http://www.cplusplus.com/forum/beginner/12458/ I'm sharing variables through namespaces and a problem arises when I try to put my function definitions into a separate file. Consider the following example, where I want to pass variable 'i', defined in the main code, to ...

Painting Issue on QWidget outsite GUI thread

I am developing an appliation in which I want to continuously receive images from remote host and display them on my screen. for this I am following the given strategy 1) I have a main QWidget object which contains the QImage on it (works fine) 2) Images received from remote host are painted on QImage object, this work is done in a worke...

Loading Qt plugins when linking to Qt statically?

Hi, I'm trying to use SVG graphics in QIcons. I have a static library that contains all my graphics resources, and a method in that static library that returns QIcons pre-loaded with the correct graphics. I'm trying to do this: QIcon icon(":/icons/find.svg"); I have verified that that resources has been loaded by listing it with QDir...

How to convert char* to PRUnichar *

I need to pass char* to XPCOM function but that function accepts PRUnichar *. How to convert from char* to PRUnichar * ? ...

Is the use of vectors of pointers here unnecessary or worse, cause memory leaks?

I am relatively new to C++ programming, but am a C programmer of 10 years so am more comfortable with pointers to objects than I am with references to objects. I'm writing a Solitaire game - is this design unsafe? Is there a better way? Anyway, I have a class SolitaireGame: class SolitaireGame: { public: SolitaireGame( in...

Accessing to QTabBar instance

Hi folks, How I can acquire access to QTabBar of QTabWidget ? Through searching in docs and internet, I've found only solution: subclassing QTabWidget, and in some way giving public access to QTabBar instance (QTabWidget::getTabBar() has "protected" access modifier). Is there any other solution ? ...

Friend class and all its descendants

Hello, suppose that I have a class A with several subclasses (B, C, and D). I need B C and D to access some protected members from a class E. Is it possible to make B, C and D friends of E in a single hit without having to list them all? I have tried with: class E { friend class A; ... }; But this doesn't work. Thank you...

CWinAppEx undefined class

Hey, I created a dialog base application using the wizard in VS C++ 2008. Haven't added any code my self. When I compile I get a few errors saying that CWinAppEx is undefined. c:\documents and settings\hussain\my documents\visual studio 2008\projects\ivrengine\ivrengine\ivrengine.h(19) : error C2504: 'CWinAppEx' : base class undefined c...

C++ Laws? (similar to Law of Big Three)

I have been reading C++ and writing small programs in it for more than a year. Recently I came across Law of The Big Three. I never knew about this law. Accidentally, I found it here: Rule of Three. May I know any other such laws in C++? ...

List box context menu

How do I add a context menu in a list box in MFC? I don't see any WM_CONTEXTMENU handler in list box's properties. Any ideas? EDIT: I followed this tutorial MFC List Control: How to use a context menu in a list control?. The tutorial says to derive my own class from CListBox which I did, but now how do I add list box of my derived class...

SecurID authentication in a Linux C++ application

Can anyone recommend how to implement SecurID authentication in Linux C++ based application? I I was thinking of the following options: An apache module for SecurID (we're using Apache on the front-end) PAM Some combination of SecurID through Radius that I've heard about but don't understand ...

Why does wide file-stream in C++ narrow written data by default?

Honestly, I just don't get the following design decision in C++ Standard library. When writing wide characters to a file, the wofstream converts wchar_t into char characters: #include <fstream> #include <string> int main() { using namespace std; wstring someString = L"Hello StackOverflow!"; wofstream file(L"Test.txt"); ...

reference a filename in vi

Sometimes I run make directly from the vim command line. However, sometimes I would just like to build one file currently being edited: !g++ filename.cpp . Is there a shortcut to reference the file without having to type it..? Guys, I DO NOT want to use make at all. all I want to do is to build it from vi's command line, using g++/gcc ...

how to move to the next enclosing brackets in VI

Are there any shortcuts to move to the next enclosing brackets. For ex: int func() { if(true) {//this point for(int i=0;i<10;i++) {//need to jump from here to //blah blah blah } } } I can move to the beginning of a function using [[ but not sure how to move to the next enclosing brackets. Thanks for any info... ...

Link error CString

I'm getting a linker error using CString the error is: error LNK2001: unresolved external symbol "private: static class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > CConfiguration::_campaignFolderPath" (?_campaignFolderPath@CConfiguration@@0V?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@A...

asm subroutine handling int and char from c++ file

how are an int and char handled in an asm subroutine after being linked with a c++ program? e.g. extern "C" void LCD_ byte (char byte, int cmd_ data); how does LCD_ byte handle the "byte" and "cmd_ data"? how do I access "byte" and "cmd_ data" in the assembly code? thanks ...

how to upload file by POST in libcurl?

how to upload file by POST in libcurl?(c++) ...

visual c++ copy textbox content

how to copy textbox->Text content in a char array? i m working in vc++. ...

Can C++ be compiled into platform independent code? Why Not?

Is it possible to compile C++ program into some intermediate stage (similar to bytecode in java) where the output is platform independent and than later compile/link at runtime to run in native (platform dependent) code? If answer is no, why? ...