Im working on this project,
The problem Im having is that the an object, does not really get deleted when I need it to be because it has a couple of shared pointers pointing to it.
How do I solve this,please help.
...
I'm new to wxWidgets (C++), and threads for that matter. What should I be aware of concerning shared resources? Should I implement some sort of semaphore-based locking of resources that may be used by both the GUI thread and the worker thread(s)? Does wxWidgets offer some capability for dealing with this?
...
Hey all
I'm (going to be) writing an application in Qt that will run on the 3 main OSes (Windows, Linux and Mac). One of the features of this app is that it needs USB to talk to a piece of custom external hardware. Would anyone know of a cross platform USB library so porting is as easy as possible? Or am I going to be slugging it out on...
Hello
I'm having problems getting this to work,
class A {
public:
A(int n) {
a = n;
}
int getA() {
return a;
}
private:
int a;
};
int main(){
A* a[3];
A* b[3];
for (int i = 0; i < 3; ++i) {
a[i] = new A(i + 1);
}
void * pointer = a;
b = (A* [])pointer; // DOESNT...
If it doesn't then how can i explicitly force it to download async. in a separate thread?
...
I usually work on multi-project solutions in visual studio.
Since the solutions themselves are not stored in the repository, I spend some time adding in the various projects via visual studio(from a list which is part of the 'parent' project).
I am wondering if I can acommplish this via a script.
ie: 1. create a solution. 2 add project...
is it possible but I guess that memory is read only. I tried something like that
void (*b)();
b = *test;
char * z = (char * )b;
and when I print contents of z, it prints constants from test function.
but that memory is read only and I get segfaults when I edit them and call test. I tried this.
char x[100];
for(i=0; i<100; i++) x[...
Is there any way to implement 33 bit unsigned integer for gcc compiler? As of now I am using unsigned 64 bit integer to store 33 bit value. But unfortunately i want the value to be reset after it reaches full 33 bits...
...
Hi,
I've tried searching A LOT for this with no luck (possibly because I'm not using the right technical terms). My issue is mainly to do with linking static libs, compiling and deploying. Before I get into details, my executables compile fine on my system; the main issue is how to deploy these as a working solution to others.
I've wr...
hello ,
I have recently started working on OpenCV using c++.I am having a problem with the following code.
#include "cv.h"
#include "highgui.h"
int g_slider_position = 0;
CvCapture* g_capture = NULL;
void onTrackbarSlide(int pos) {
cvSetCaptureProperty(
g_capture,
CV_CAP_PROP_POS_FRAMES,
pos
);
}
int main( int argc, ch...
I wrote a template function to compare two variables:
template <class t>
int compare(const t &a, const t &b) {
if(a>b) return 1;
if (a<b) return -1;
return 0;
}
int main(int argc, const char *argv[])
{
cout << compare("hi","world");
return 0;
}
I get the following error
../src/templates.cpp: In function ‘int main(int...
Hi, suppose I have a class defined as follows
class foo
{
char [10] bar;
}
How would the size of this class differ when in a 64 bit environment compared to a 32 bit one, assuming no padding/packing.
I believe the 64 bit version of the class would be 4 more bytes in length since:
The class must contain a char* in order to point ...
Will fnc like this extend returned object lifetime? If not, are there a ways to do so?
const int& f () //<<----Here you see, I'm returning by ref to const int
{
return 1;
}
...
The structure is defined as
struct state{
string node_name;
int node_no;
int node_val;
int occupant;
vector<int>node_con;
};
state s[100][100]
I want to send it to a fucntion along with i and j values , where s[i][j] , (i->rows , j-> columns) . How will the struct be sent with both i and j ?
...
Hi ,
I am dealing with code legacy and in UI i can find some id's of my objects which are used at run time.
Those id's could help me to find more quickly the portion of code with which i am dealing for that requirement,but i do not know if it is possible to do in debug mode from Visual Studio 2010 (C++ and C#) a search after a value...
I wrote the absolute function using ternary operator as follows
int abs(int a) {
a >=0 ? return a : return -a;
}
I get the following error messages
../src/templates.cpp: In function ‘int abs(int)’:
../src/templates.cpp:4: error: expected primary-expression before ‘return’
../src/templates.cpp:4: error: expected ‘:’ before ‘return’
....
The company I work for has a large native MFC based application. We're currently using vs2008, but for the next version we're hoping to move to vs2010, mainly for the new C++0x features. Unfortunately we've a very small minority of Citrix customers who are sticking with Win2k server due to licence costs.
I discovered today that there i...
I am trying to use random::linear_congruential in boost (http://www.boost.org/doc/libs/1_33_1/libs/random/random-generators.html#linear_congruential) to generate uniform random numbers. The declaration is defined as:
template<class IntType, IntType a, IntType c, IntType m, IntType val>
Does anyone know what the last parameter IntType ...
Hi,
I have developed two extensions bars using C++ on firefox 3.6 on mac osx 10.5. The extensions used some code which is common across both such as string library, std library etc...
Firefox crashes whenever I open with both the extensions on. I checked with individual extensions and observed no issues.
After analysing the stack trac...
i wanted to declare a very large array. i found that the max size of an array is size_t, which is defined as UINT_MAX
so i wrote the code like this
int arr[UINT_MAX];
when i compile this, it says overflow in array dimension
but when i write like this
size_t s = UINT_MAX;
int arr[s];
it compiles properly.
what's the difference
...