c++

How to create a library that wraps an object with a template function using minimal includes?

The goal of this project is to create a library for distribution. In the past, I used forward declares so I didn't have to distribute a bunch of header files along with the libraries. However, I'm now trying to eliminate code duplication by switching to templates and am running into some issues. First, a simple example project showi...

Doubly linked lists in C++

What is a doubly linked list? If someone could provide some C++ code to help explain then that would be much appreciated. ...

Which API should I use for playing audio on Windows?

There are many ways of playing sounds on Windows. Which are the differences, advantages and disavantages of each method? I know there are at least 5 methods: 1991 WinMM.dll/mmsys.dll PlaySound 1995 MCIWnd (as suggested by @casablanca) 1996 DirectSound 1998 WaveOut 1999 ASIO 1999 Windows Media Player ActiveX control? 2005 WASAPI (which...

Xcode: multiple projects, more than one main executable

Hi I'm new to Xcode. I'm trying to learn c++ and I was wondering if it is possible to have multi projects and choose which project should run. I used ms visual studios before and I like how under a solution I can create multiple projects and choose which one is the executable one. Xcode also has targets not exactly sure what they are may...

Question regarding C++ preprocessor while using #define to conditionally exclude a main function.

Here's the situation: I have three files, Test1.cpp and Test2.cpp. Test1.cpp can be compiled as-is into a stand-alone application. Test1.cpp also contains some functions that I would like to re-use in Test2.cpp. I'm using an #ifndef #endif block to conditionally exclude the main function of Test1.cpp so that when I compile Test2.cpp, ...

Getting actual keycode for ibus settings

Hi, I am able to read the ibus keys configuration to know the keys that trigger an engine ON/OFF (accessible via the property "general/hotkey" and "trigger"). that is all good but that returns lists of strings (gchar*) which combination switches ON/OFF the IME (ex: ["SHIFT+CTRL+F9", "SHIFT+UNDERSCORE",...]). How can I get the correspon...

How do we modify OpenCV and generate new DLLs

Hello! The OpenCV library is great. Most functions have the required functionality, however, I would like to modify some of the functions and recompile so that it fits my specific needs. how would we recompile the dlls and other files? is there a built-in script or do we need to write all the scripts ourselves? ...

Question on reuse of pointers after passing to functions

So, when I pass a const char * to a function once, can I use it again? It appears to end up spitting out crap to me. const char *config_file = "file.txt"; function(int x, config_file); cout << "Number" << x; secondfunction(int y, config_file); Do I need to make another pointer to config_file? If so, how do I do that? Thanks! ...

TInyXML++ Premake with Visual Studio 2010

I tried to compile TinyXML++(or TICPP) using premake4 with these settings: "premake4 vs2010 [--unicode] [--ticpp-shared] [--dynamic-runtime]". It compiles the .libs but I can't compile TiCPP.vcxproj because the compiler says "Unable to start program c:\ticpp\lib\ticpp.lib. This file is an unrecognized or unsupported binary file." Anyone ...

Deployment of Visual C++ 2008 program

I have a c++ code developed with Visual C++ 2008, which creates a .exe file in the dubug subfolder of the application. The program runs properly on the development machine, a Windows Vista PC, but does not run when installed on another machine, a Windows XP PC on which Visual c++ 2008 is not installed. (I used InstalShield 2010 to deploy...

glGenLists(1) return 0 outside OnPaint() with wxThread

Hi there, Currently, I am trying to separate the display list from the OnPaint(), but glGenLists(1) return 0. Is there any prerequisite on using display list? Is function glGenLists(1) only survive inside OnXxx() event thread? Thank you! ...

Communicating over telnet

I can't use Boost ASIO (reasons not related to programming) and I looked around and libcurl looks good. I'm building the binaries at the moment and decided to get some feedback from the community. Any comments regarding libcurl/alternatives? UPDATE: libcurl's not great for telnet. It's 2010! Shouldn't there be a simple way to do this?...

The best C++ book

Possible Duplicate: The Definitive C++ Book Guide and List I want to learn to program in c++, currently i find difficult to make programs and design a structured one. I want to learn how to develop good logic for the programs , as well as i want to learn all the nuances of c++ language.Please tell me as to what i should do to ...

Treating double variable as boolean

Which is the better way(efficiency/best practice wise) to test if a double variable is equal to 0? 1. if(a_double) ..... else ..... OR 2. if(a_double == 0) ..... else ..... ...

DoModal() not bringing up dlg box as modal

I have a window with the following properties set int he .rc file: STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU It has an associated class (derived from CDialog) and when I instantiate it, then call that object's DoModal() on it it is not really modal - I can click on the "parent" window. CMyDl...

How to generate a exe program through programming ?

I want to write a application which can use to generate .exe program automatically from some word and txt files. How can I implement this ? Is it possible to generate a exe program with programming ? ...

How to generate a exe program through programming ?

Possible Duplicate: How to generate a exe program through programming ? I want to write a application which can use to generate .exe program automatically from some word and txt files. How can I implement this ? Is it possible to generate a exe program with programming ? ...

Assertion Failed! error

Hi I have a C# web application with a C# ActiveX tool that connects to the user's hardware to collect information. anyways all works fine on most computer except on some it shows me a (sometime on resetting of CAS permissions it works but soon starts throwing a fit) "Assertion failed!" error (See screenshot) new SecurityPermission(P...

C++ initialize anonymous struct

I'm still earning my C++ wings; My question is if I have a struct like so: struct Height { int feet; int inches; }; And I then have some lines like so: Height h = {5, 7}; Person p("John Doe", 42, "Blonde", "Blue", h); I like the initialization of structs via curly braces, but I'd prefer the above be on one line, in an anony...

long lines of integer arithmetic

Two Parts two my question. Which is more efficient/faster: int a,b,c,d,e,f; int a1,b1,c1,d1,e1,f1; int SumValue=0; // oops forgot zero // ... define all values SumValue=a*a1+b*b1+c*c1+d*d1+e*e1*f*f1; or Sumvalue+=a*a1+b*b1+c*c1; Sumvalue+=d*d1+e*e1*f*f1; I'm guessing the first one is. My second question is why. I guess a third que...