c++

Embedded wxLua not displaying most controls (but still does layout correctly)

I am having trouble getting embedded wxLua to work with my application -- it works fine when I use the wxLua DLLs, but I'm trying to use the static libraries so I can distribute a single, standalone executable with no external dependencies. First, the symptoms: Most controls (such as wxButtons, wxGauges, wxTextCtrls) do not display; at ...

the quake 2 md2 file format (theory)

i am trying to load md2 files in opengl but i noticed that most example programs just use a precompiled list of normals. something like this..... //table of precalculated normals { -0.525731f, 0.000000f, 0.850651f }, { -0.442863f, 0.238856f, 0.864188f }, { -0.295242f, 0.000000f, 0.955423f }, { -0.309017f, 0.500000f, 0.80901...

gcov creates .gcov files in the current directory. Is there any way to change this?

I'm running gcov/gcc 4.1.2 on RHEL. When I want to specify a directory for the gcov files. Any ideas on how to do this? ...

How to set the culture info in unmanaged C++?

Hello, I got a program written in unmanaged C++, I need to get the cultural info from the system and set that info to the current execution thread in my c++ application. Thanks. ...

What C++ idioms should C++ programmers use?

Question What C++ idioms should C++ programmers know? By C++ idioms, I mean design patterns or way of doing certain things that are only applicable for C++ or more applicable for C++ than most other languages. Edit: Please explain why one should use the idioms and what the idioms do. ...

a good C++ book for someone who needs a QUICK refresher

A good C++ book for someone that needs a GOOD, BUT QUICK REFRESHER on templates, virtual void, inline, the finder points, extern, etc, etc ...

How to print pthread_t

Searched, but don't come across a satisfying answer. I know there's no a portable way to print a pthread_t. How do you do it in your app? UDP: Actually I don't need pthread_t, but some small numeric id, identifying in debug message different threads. On my system (64 bit RHEL 5.3) it's defined as unsigned long int, so it's big n...

Regular expressions performance: Boost vs. Perl

I'm looking for a performance comparison between perl and boost regular expression. I need to design a piece of code which relies very heavily on regular expressions, and can choose between: running it through a boost regex dispatching a perl interpreter and do the work in perl I know perl is known for it's optimized string pro...

"error: assignment of read-only location" in unordered_map (C++)

I have an awkward hash table (specifically, an unordered_map) with int keys and vector< vector< int >> data. I periodically need to update elements in this two-dimensional vector of ints. There's no intrinsic reason I shouldn't be able to, right? A newer g++ compiler I've switched to complains of an assignment of read-only location on th...

How to resolve this Shift/Reduce conflict in YACC

I have a grammar like this: "Match one or more rule1 where rule1 is one or more rule2, where rule2 is one or more rule3, etc. etc. each seperated by newlines". Look at the following example. start: rule1_list ; rule1_list: rule1 | rule1_list NEWLINE rule1 ; rule1: rule2 | rule2 NEWLINE rule3...

Is compiler allowed to ignore inline in case of template specialization?

Hello everybody. Lets say you have simple template function (not class member for the sake of simplicity) with type specific specialization in the same .h file... template <class TYPE> void some_function(TYPE& val) { // some generic implementation } template <> inline void some_function<int>(int& val) { // some int specific ...

Possible to Use typeid to Determine Parent-Child Relationship

Hi all, all the while, I am using dynamic_cast to determine Parent-Child relationship of an object. #include <iostream> class A { public: virtual ~A() {} }; class B : public A { }; class C : public A { }; int main() { B b; std::cout<< typeid(b).name()<< std::endl; // class B A* a = dynamic_cast<A *>(&b); ...

Convert latex to html in Java or C++?

There are many tools for converting latex into html. I'm looking for a Java or C++ program to do this. It will need to run on multiple operating systems. The solution will be used on academic papers, so it should ideally also be able to interpret things like bibtex. I found htmltolatex which is a "Java program for converting HTML pag...

console app c++

hello all, i'm new to console apps and would appreciate some pointers... i have created a new console app and (not finished but it should be working), i selected win32 console app and then selected 'empty project' here's my code: #include <iostream> void main() { struct dude { string name; int age; } about; about.name ...

Abstract Base Class with Data Members

If I'm creating an abstract base class, and the classes derived from it are going to have some of the same data members, is it better practice to make those members private in the abstract base class and give protected access to them? Or to not bother and just put the data members in the derived classes. This is in C++. ...

Exposing unmanaged const static std::string in a managed C++ class

I have a non-.NET C++ class as follows: Foo.h: namespace foo { const static std::string FOO; ... } Foo.cc: using namespace foo; const std::string FOO = "foo"; I want to expose this for use in a C# application, but I keep getting errors about mixed types when I try the following: FooManaged.h: namespace foo { namespace NET...

What does this error message mean?

Hi all, In C++, on this site: http://msdn.microsoft.com/en-au/visualc/bb985511.aspx I downloaded the code sample and went to Debug and it came up with a messagebox with 2 textboxes in it and told me to specify the executable file to debug. So I did, and then I clicked browse, but there is NO executable because the stupid thing hasn't c...

String encoding of primitive types preserving lexicographic order

Does anyone know of a library for encoding a number of primitive types (like integers, floats, strings, etc) into a string but preserving the lexicographical order of the types? Ideally, I'm looking for a C++ library, but other languages are fine too. Also, one can assume that the format does not need to be encoded in the string itself ...

Compose output streams

I'd like to compose two (or more) streams into one. My goal is that any output directed to cout, cerr, and clog also be outputted into a file, along with the original stream. (For when things are logged to the console, for example. After closing, I'd like to still be able to go back and view the output.) I was thinking of doing somethin...

Encapsulating WndProc Problem.

Okay so i wrote a basic class to do encapsulation of a win32 window. I ended up creating a static router callback function to route the messages into another function of the class. EDIT OKAY I Got it m_MainWindowHandle = CreateWindowEx( windowFormat, L"LUDO ENGINE", m_WindowName.c_str(), WS_OVERLAPPEDWINDOW, CW_U...