c++

C/C++/Objective-C text recognition library

Does anyone know of any free/open-source text recognition libraries in C/C++/Objective-C? Basically something that can scan an image, and read out all of the plain text. ...

How to use "billboards" to create a spherical object on the screen

I am tasked with making a sun/moon object flow across the screen throughout a time-span (as it would in a regular day). One of the options available to me is to use a "billboard", which is a quad that is always facing the camera. I have yet to use many direct x libraries or techniques. This is my first graphics project. How does th...

initializer-string for array of chars is too long

I keep getting this error: initializer-string for array of chars is too long Even if I change num and length to 1, it still gets the error: #include <iostream> #include <cstring> using namespace std; int main() { const int num = 11; const int length = 25; char array[num][length] = { "Becky Warre, 555-1223" ...

C++ Templated return

Hey Folks, I have a program which is built on "Entities", which hold "Components" (composition FTW). Components may include many different types including scripts, assets, etc. I would like to build an Entity function called Entities have a map of strings, and actual Components, such that the Components can be searched for by type na...

Unexpected results using istringstream for string to double conversion in C++

I'm currently trying to take a string ("0.1") and convert it to a double using C++ in Xcode on 10.6 with gcc4.2. I'm using a function I pinched from another question, but when I try to use the function, my input according to gdb is (string)"0.1", but my output is (double)2.1220023981051542e-314. Here is my snippet copied straight out t...

What is best practice for C++ Public API?

What is best practice for C++ Public API? I am working on a C++ project that has multiple namespaces, each with multiple objects. Some objects have the same names, but are in different namespaces. Currently, each object has its own .cpp file and .h file. I am not sure how to word this... Would it be appropriate to create a second .h fil...

illegal reference to non-static member 'Sun::m_SunTexture'

Hi, I am not overly competent in C++ and this compiler error is just making no sense to me. The following line calls the compiler error shown in the title: m_SunTexture = LudoTextureManager::GetInstance()->GetTextureData(hardcoded.c_str()).m_Texture; where m_SunTexture is defined in my header file as IDirect3DTexture9 *m_SunTexture...

Modify dll exports (symbol table). I want to obfuscate the function names.

I have a third party dll that I want to change the symbol names. Is this possible? I dont want the competition to know what component my product uses. I don't have the source for the dll. ...

When I change a parameter inside a function, does it change for the caller, too?

I have written a function below: void trans(double x,double y,double theta,double m,double n) { m=cos(theta)*x+sin(theta)*y; n=-sin(theta)*x+cos(theta)*y; } If I call them in the same file by trans(center_x,center_y,angle,xc,yc); will the value of xc and yc change? If not, what should I do? ...

C++ Headers - Best practice when including

C++ headers If I have A.cpp and A.h as well as b.h, c.h, d.h Should I do: in A.h: #include "b.h" #include "c.h" #include "d.h" in A.cpp: #include "A.h" or in A.cpp: #include "A.h" #include "b.h" #include "c.h" #include "d.h" Are there performance issues? Obvious benefits? Is something bad about this? ...

Using point sprites with direct x. what steps need to be taken?

This is still an outstanding issue. I am trying to get a point sprites system workign render a sun in my world. I noticed another user asking a similar question (with the same code, presumably from my class :) ) but they were not able to complete this. My current code for this is as follows: float fPointSize = 10.0f,fPointScaleB =...

Problem reading and writing from same file within same program... C++

I'm working on a program, that needs to load data from a text file upon starting and save data to THE SAME text file upon exit. I have the load working, and i have the save working, but for some reason I cant seem to have them both work within the same program. This doesnt work... ifstream loadfile("test.txt"); ofstream savefile("test....

What is wrong with this c++ typedef?

This is a piece of my code, I have more class like MathStudent, ArtStudent, etc. which inherits Student class. When I tried to compile, it says "forbids declaration of `vector' with no type," what is the problem here? thanks class Student { public: typedef vector<Student> Friends; // something wrong here? virtual unsigned int ...

CAtlNavigateData can not deal with special symbol such as +

CAtlNavigateData navData; CStringA m_strForm = "name=+++&priv=1&password="; navData.SetSocketTimeout(m_nMilliSecond); navData.SetMethod(ATL_HTTP_METHOD_POST); navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.GetLength(), QHTTP_FORM_URLENCODE); I catch the posted package, and find post data name = "", it should be name=...

C++ Template specialization to provide extra member function?

Hello, how do I provide extra member function for specialized template in a non-inline way? i.e. template<typename T> class sets { void insert(const int& key, const T& val); }; template<> class sets<bool> { void insert(const int& key, const bool& val); void insert(const int& key){ insert(key, true); }; }; But when I write ...

Why are two different concepts both called "heap"?

Why are the runtime heap used for dynamic memory allocation in C-style languages and the data structure both called "the heap"? Is there some relation? ...

problem in boost threadpool library

hi, I want to use the boost threadpool library from open source(http://threadpool.sourceforge.net/) I am getting an complilation error with the example program itself. /usr/include/boost/./threadpool/./detail/locking_ptr.hpp: In constructor âboost::threadpool::detail::locking_ptr::locking_ptr(volatile T&, const volatile Mutex&) [with ...

Method for solving error: "cannot instantiate abstract class"

I find one of the most time-consuming compiler errors for me is "cannot instantiate abstract class," since the problem is always that I didn't intend for the class to be abstract and the compiler doesn't list which functions are abstract. There's got to be a more intelligent way to solve these than reading the headers 10 times until I fi...

How to deal with initialization of non-const member in const object?

Let's say you have a class class C { int * i; public: C(int * v):i(v) {}; void method() const; //this method does not change i void method(); //this method changes i } Now you may want to define const instance of this class const int * k = whatever; const C c1(k); //this will fail but this will fail be...

C++ Find the number of elements in a range from an STL::multimap

I have a STL::multimap and I search it with equal_range to return an upper and lower bound. Can I find the number of elements in this range without iterating through them all and counting them one by one? #include <iostream> #include <map> using namespace std; int main () { multimap<int,int> mm; pair<multimap<int, int>::iterat...