c++

Constructor with reference arguments in g++ compiler

Hi All, Have a look at the following piece of code Header File: class CxUser { public: CxUser(string& guid) {} }; I have a c++ file that instantiates the class using CxUser(string("xxx-xxx-x-xxxx")). But this statement fails to compile in g++ with error "no matching function for call to CxUser::CxUser(std::string)" whereas it ...

how to compile text-to-speech festival voice free library on win32 with VC

Hello all i need to embed text-to-speech into my application with human void not robotic i found about festival lib that seams good the only problem is after reading the docs im not sure if its working on windows or not ? did someone manage to compile the lib on windows without sygwin ...

C++ inline methods with same if statements

Hello, i'm writting handler for OpenGL texture and i'm thinking about safety and performance. Which level of optimization should remove marked if statements? struct Texture2D { GLuint ID; inline Texture2D(): ID(0) {}; inline explicit Texture2D(GLuint id): ID(id) {}; ~Texture2D(); void GenTexture(bool regen = false...

Problem with MPEG2/MP4 video Demux

I've been working with Directshow for some time now. I've been working with codes (GMFBridge), and I recently started working with mp4demux. I saw it does a good work demuxing many compressed types, but there are a few types I work with that it still can't demux. I'm writing to ask about these ones. I have here a sample of a XDCAM-EX fi...

Can functions be in a struct?

Can we describe functions in a struct? For example, is this code valid? struct function { int func() { return 5; } }; ...

C++: inheriting overloaded non-virtual method and virtual method both with the same name causes problem

Hi all, I am trying to inherit two equally named methods with different parameter lists to a derived class. One of them is virtual and overridden in the derived class, the other one is non-virtual. Doing so, i get a compile error while trying to access the non-virtual method of the base class from an derived class object. Here is the ...

errors porting C++ templates from GCC to Visual C++

The following compiles in GCC: cvec.hpp: template <class T> class cvec : public deque<T> { class deque<T>::iterator Find(T); }; cvec.cpp: template <class T> class deque<T>::iterator cvec<T>::Find(T element) { } In Visual C++, get error C2242 "typedef name cannot follow class/struct/union. I changed "class" in the header f...

Where to find information on Embedded C++ ?

Hi All, I want to find information on "C++ programming in an embedded platfrom". I googled it but I was unable to find sufficient information on that topic. What exactly I want to find is How exactly C++ is useful in an embedded environment with detailed description and examples (if they are available) Can anyone please suggest any li...

C++: Rounding up to the nearest multiple of a number

OK - I'm almost embarrassed posting this here (and I will delete if anyone votes to close) as it seems like a basic question. Is this the correct way to round up to a multiple of a number in C++? I know there are other questions related to this but I am specficially interested to know what is the best way to do this in C++: int round...

What is fastest method to calculate a number having only bit set which is the most significant digit set in another number?

Possible Duplicates: Previous power of 2 Getting the Leftmost Bit What I want is, suppose there is a number 5 i.e. 101. My answer should be 100. For 9 i.e. 1001, the answer should be 1000 ...

stringstream fails "streaming" negative values in unsigned types?

I'm having same issue in Ubuntu 10.04 using gcc4.4, the same code works fine on RH 5.5 using gcc4.1 #include <sstream> #include <iostream> int main(int argc, char** argv) { std::stringstream myStream; myStream << "-123"; unsigned int myUInt; myStream >> myUInt; if(myStream.fail()) { std::cout << "FAILED" << std::endl; ...

Help with InternetOpenUrl and InternetReadFile in <WinInet.h> API

I am trying to simply access a page using the WinInet APIs. Once I access it, I'd like to be able to read the contents into a string. I've already initialized the root node. Here's what I got so far: HINTERNET hChildURL = InternetOpenUrl(hInternetRoot, LPCTSTR(CString("http://www.google.com/")), ...

Unknown errors during compile.

Coding in Visual Studio 2008 using Windows Audio Core APIs, I need access to devicetopology.h header file. After including it in my header file I have these errors: Ошибка 8 error C2011: _DDPIXELFORMAT: переопределение типа "struct" c:\program files\microsoft sdks\windows\v6.0a\include\ddraw.h 703 Player Ошибка 9 error C2079: "...

How do I put a checkmark on a menu item that has submenu items. (Visual studio 2008 C++/MFC)

I have a menu that contains submenus. eg: Item1 Item2 Item3 item A Item B Item3 has items under it. At any given time 1, 2, or the items under 3 should be checked. Since I don't have an ID for Item3 I have to use the MF_BYPOSITION indicator when I try to set a check on Item3 to indicate one of its children has a checkmark. Item...

How does a memory leak improve performance

I'm building a large RTree (spatial index) full of nodes. It needs to be able to handle many queries AND updates. Objects are continuously being created and destroyed. The basic test I'm running is to see the performance of the tree as the number of objects in the tree increases. I insert from 100-20000 uniformly size, randomly locat...

Design pattern to refactor switch statement

I have something like the following in the header class MsgBase { public: unsigned int getMsgType() const { return type_; } ... private: enum Types { MSG_DERIVED_1, MSG_DERIVED_2, ... MSG_DERIVED_N }; unsigned int type_; ... }; class MsgDerived1 : public MsgBase { ... }; class MsgDerived2 : public MsgBase { ... ...

Best Platform and Programming Language for Network Mapper Software

I want to do my final year project,and thinking of researching and building a network mapping software,But i dont know which programming language(Java,C++,C,Visual Basic)/platform(Linux,Unix,Windows) is best for this research software.Please any suggestions will be highly appreciated. Flaws...i am familiar in Java but not Good in C and ...

C++ Soap Toolkits

Hi, I am looking for a SOAP toolkit which i can use with C++ language on Linux system.I have taken a look at AXIS2C and i find it poorly documented. gSoap unfortunately requires a license, so are there any others which are out there ? Cheers! ...

Floating point C++ compiler options | preventing a/b -> a* (1/b)

I'm writing realtime numeric software, in C++, currently compiling it with Visual-C++ 2008. Now using 'fast' floating point model (/fp:fast), various optimizations, most of them useful my case, but specifically: a/b -> a*(1/b) Division by multiplicative inverse is too numerically unstable for a-lot of my calculations. (see: Microsoft...

C++: Inheritance v. Containment for a templatized class

I have the following struct: template <typename T> struct Odp { T m_t; }; I want to specialize it so I can add an operator so the type plays nicely with STL sets. (I can't modify Odp directly; it's legacy code.) Here are two methods I see of doing it: struct Ftw : public Odp<int> { bool operator==(const Ftw& rhs) { ...