I'm debugging this database project. It wraps access to SQLite for a higher level application. It's designed to run asynchronously, that is, it has methods like ExecuteRequestAsync() and IsRequestReady(). When ExecuteRequestAsync is called, it spawns a boost::thread to do the job and return the function immediately. When the higher level...
{net04:~/xxxx/wip} gcc -o write_test write_test.c
In file included from write_test.c:4:
global.h:10: warning: `b' initialized and declared `extern'
This code uses fcntl.h and the file-handling functions defined - like open(), write(), close() etc..
The code compiles and works as intended.
{net04:~/xxxx/wip} gcc -o write_test write_t...
When i use dlopen to dynamically load a library it seems i can not catch exceptions thrown by that library. As i understand it it's because dlopen is a C function.
Is there another way to dynamically load a library that makes it possible to catch exceptions thrown by the lib in GCC?
In Windows you can use LoadLibrary but for Linux i ha...
Currently Visual Studio just starts cl.exe for C++ source compilation. cl.exe needs to be in one of folders listed on the %PATH% environment variable.
Since there're separate versions of cl.exe for 32-bit and 64-bit compilation in order to compile a 32-bit project after compiling a 64-bit project it is necessary to restart Visual Studio...
I'm trying to write a chat client for a popular network. The original client is proprietary, and is about 15 GB larger than I would like. (To be fair, others call it a game.)
There is absolutely no documentation available for the protocol on the internet, and most search results only come back with the client's scripting interface. I ca...
This is child's play, but I'm a bit of a vc n00b.
I get an error: error C2143: syntax error : missing ',' before '<'. on the second line of the following code:
template<int i, int j>
class B : public A<i, j> { }
template<int i, int j>
class A { }
Thanks for the help!
...
Hello, I'm working on a game and am trying to implement a smart way to create npc-objects in C++ from parsing a text file.
Currently this is hard coded in a Factory-object. Like this:
IActor * ActorFactory::create(string actortype, Room * r, string name, int hp)
{
if(actortype == "Troll")
{
return new Troll(r, name, hp);
...
How to convert string from one charset to another in C++ in a portable way? For example I want to convert to wstring to UTF-8 character array or . How to do this?
I am asking some standard way no chilkatsoft, wxWidgets, Qt. Its a plain C++ application. Though some simple class or methods will do the job.
...
Hi all! I'm new here and my english is not really good. Apologize any inconvenience!
I'm programming an application for windows mobile with native code (MFC). I'm trying to open a file and this is driving me crazy. I've tried to open it in a thousand diferent ways... And I really achieve it, but when I try to read (fread or getline) t...
I am fetching the call-logs, appending them on information note using:
CAknInformationNote* note = new (ELeave) CAknInformationNote;
note->ExecuteLD(callLogs);
I perfectly run on emulator (show all call-logs on note) but nothing shows up when run on the actual device (a Nokia N73). Any ideas?
...
Consider the following example code:
class Foo
{
};
class Bar : public Foo
{
};
class FooCollection
{
protected:
vector<shared_ptr<Foo> > d_foos;
};
class BarCollection : public FooCollection
{
public:
vector<shared_ptr<Bar> > &getBars()
{
// return d_foos won't do here...
}
};
I have a problem like this in ...
I'm writing an LCD controller, and one feature I want to add is the ability to catch keyboard strokes so that you can do stuff like instant messaging over the LCD. I found xsnoop.c but it's outdated. I'm using xorg-x11-server 1.6.4-0.1.fc11 on Fedora 11. I'm also using Qt. I didn't find anything in the docs that might help, but figured I...
I currently have a class hierarchy like
MatrixBase -> DenseMatrix
-> (other types of matrices)
-> MatrixView -> TransposeView
-> DiagonalView
-> (other specialized views of matrices)
MatrixBase is an abstract class which forces implementers to define operator()(in...
I'm working with a legacy class that looks like this:
class A
{
enum Flags { One = 1, Two = 2 };
};
I'd like to pull out all the enums into a new namespace defined in a new header:
// flags.h
namespace flags {
enum Flags { One = 1, Two = 2 };
};
Then pull these enums back into the class so that I can include just the flags.h...
I want to use an older code-fragment in my Qt-project, which is using WinSocks.
I created my program with Qt Creator and I don't know, how I can link to the ws2_32-Library. I already added LIBS += -lws2_32 to my .pro, but nothing happened. So how can I link to this library?
edit: Where can I find the ws2_32.lib to include it? Do I have...
Hi
I am observing a crash within my application and the call stack shows below
mfc42u!CString::AllocBeforeWrite+5
mfc42u!CString::operator=+22
No idea why this occuring. This does not occur frequently also.
Any suggestions would help. I have the crash dump with me but not able to progress any further.
The operation i am performi...
Suppose my COM object implements two or more COM interfaces:
class CMyClass : public IPersistFile, public IPersistStream {
};
when implementing QueryInterface() I need to be able to return an IUnknown* pointer. Since both base interfaces are derived from IUnknown I cannot upcast implicitly - such upcast would be umbiguous. To upcast e...
Hello,
I learned in THIS THREAD how a hashed_unique<> index can be used with a composite_key using an int and a std::vector<int>. But unfortunately the following code produces quite an error message:
1> boost/multi_index/hashed_index.hpp(439) : error C2784: 'size_t .. composite_key_hash<...>::operator ()(const boost::tuples::tuple<......
My model would best use some
v int[30][i][N_i];
structure that is 30 vectors of tuples of ints, where
v[0] is a dummy,
v[1] are plain ints (N_0 of them),
v[2] are pairs of int (N_1 pairs)
...
v[29] would be 29-tuples of int (N_29 of them)
This is not vector<vector<int>> like in "generic-vector-of-vectors-in-c"
Apparently, the out...
I have a rather huge .dat-file (896MB) included as a BIN resource in my project. Now I get a LNK1106 link error ("fatal error LNK1106: invalid file or disk full: cannot seek to 0x382A3920".)
I use Visual Studio 2005 under Windows XP, and have tried on a 4GB RAM machine with high Virtual Memory settings and lots of disk space.
I have tri...