I have a very old, very very large, fully working, C program which plays a board game. I want to convert it (or should I say parts of it) to work in multiple threads, so that I can take advantage of multi-core processors. In the old program there is a global UBYTE array called board[]. There are a great many (highly optimized, highly spe...
I know this might be an oversimplification - but I need to know the amount of free memory I could allocate in my program.
It's a windows mobile project (c++) and it seems like I might have a memory leak hiding somewhere. Calling a function which returns the remaining size (or remaining chunks) of heap storage I could access would be perf...
I am trying to learn more about list containers and how to iterate through them, but it seems that g++ has no problem with it, but Visual Studio C++ pukes all over the place!
#include <iostream>
#include <string>
#include <list>
using namespace std;
int main(){
list <string> data;
list <int>::iterator it;
data.push_back("fe...
I am trying to do some socket programming, writing a simple client-server program. But when I try to compile the program, I get this error.
gcc -o showip showip.c -lnsl -lsocket -lresolv
showip.cc: In function ‘int main(int, char**)’:
/usr/bin/ld.real: cannot find -lsocket
collect2: ld returned 1 exit status
I try to install lib doing...
Hi
I'm writing an app in C++ using openssl, and I can't seem to get the ssl socket connection to work.
I have an abstract class, with multiple functions implemented using various protocols by the inheriting classes and simple TCP and UDP ( posix sockets ) work fine.
I could not get the ssl working though and after some code browsing ...
Hey guys, I am a little new to the whole makefile concept so I have some questions regarding it.
I am creating a project using CodeBlocks in linux, I used a tool called cbp2mak to create a .make file out of the CodeBlocks project (if anyone knows a better tool please let me know).
Now i'm not sure what the difference is between .mak an...
This is a really weird problem. I'm compiling a C++ project on Solaris 10, with cc "Sun C 5.7 2005/01/07" and Bison 1.25 (if that matters). After finally getting the libs built, it still fails to link the executables, with following error message:
Undefined first referenced
symbol in fi...
I'm trying to load tables from Lua to C++ but I'm having trouble getting it right.
I'm getting through the first iteration just fine but then at the second call to
lua_next it crashes. Any ideas?
Lua file:
level = { 1, 2, 3, }
C++ file - First I did this:
lua_getglobal( L, "level" );
for( lua_pushnil( L ); lua_next( L, 1 ); lua_...
if yes.. then which compiler is best for compiling them?
...
For some reason excode is throwing this error when I try to cin into a string.
test(5640) malloc: * error for object 0x1000041c0: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Program received signal: “SIGABRT”.
sharedlibrary apply-load-rules all
Here is the code that produced that:
...
Hi
I don't know how you guys test your code every time you code a little and for different levels of testing: unit testing, Integration testing, ...
For example, for unit testing a function you just wrote, do you write another whole set of main function and Makefile to test it? Or do you modify the main function of your project to test...
Hi
Just wonder how to modify the values of multiple elements of an array under gdb for C++?
Thanks and regards!
...
Hello,
Is there a list any where of C++ Events/Notifications & Default handling method list.
For example, it would be useful to know that by default, the HDN_DIVIDERDBLCLICK notification is normally handled by the CWnd::OnLButtonDblClk method.
This would make it easier to find the correct method when wanting to call it when you write y...
Hi,
Here's the demo code:
QList<Custom> L;
QVariant v(QVariant::fromValue(l));
QDataStream d;
d << v;
The problem seems to be that d doesn't know how to stream v, because v doesn't know how to do a metatype save on L. I have registered Custom and L as metatypes and I've also registered their IO streams, but L has no meta object, and I...
Hi,
what wrapper class can you recommend for IPC on Win32? I have tried XQueue, I found it slightly clunky, and would like to hear what else is out there. Building something on InterlockedPopEntrySList() seems nice but that requires server 2003.
Thanks,
Adam
...
I was looking at some code and they had this line: #define WINVER 0x0501 in stdafx.h file? Why do you need to define WINVER? How does it affect your code? Can someone please explain?
...
For some tracing automation for identifying instances i want to call either:
a non-static method of the containing object returning its identifier
something else which always returns the same id
My current solution is to have a base class with a method which() and a global function which() which should be used if not in the context o...
I have a .exe created with a windows subsystem. I copy that .exe to another .exe, and I run:
editbin.exe /SUBSYSTEM:CONSOLE my.exe
So my intention is to have a .exe that runs with a GUI, and another .exe that is meant for command line operations (no GUI).
How do I check what subsystem is currently active in my C++ code?
...
I have a cpp file like this:
#include Foo.h;
Foo::Foo(int a, int b=0)
{
this->x = a;
this->y = b;
}
How do I refer to this in Foo.h?
...
I need some kind of event from Windows whenever there is a monitor that's getting plugged into system. Is there any API in Windows to do that. BTW, it is an C++ application
...