Is it possible to include C/C++ header files in a qmake (.pro) file?
I have a version.h header file with several definitions for my project (strings, version numbers, etc.). I also have an .rc file for Windows to add version info to my exe/dll, which includes this header file.
So, can I somehow get the #defines in my header file to be ...
I am new to COM and need to add a Server COM object to my c# application so I can call its methods and implement events. The documentation I have says this requires a COM-aware language such as Visual C++. My app is written in C# so I'm not sure how this is going to work. Any direction would be appreciated.
I am writing an app that c...
I have the following struct:
struct SysData
{
// Topic (32 bits)
UTL_UINT16_Tdef SystemID:11; // set to decimal 25
UTL_UINT16_Tdef TypeID:5; // set to 2 (telemetry type)
UTL_UINT16_Tdef ContentID; // set to decimal 1234
}
SysData MsgHdr;
MsgHdr.SystemID = 25;
MsgHdr.TypeID = 2;
MsgHd...
I'm working with std::list in my current project. But there is a memory leak somewhere connected with this. So I've tested the problematic code separately:
#include <iostream>
#include <string>
#include <list>
class Line {
public:
Line();
~Line();
std::string* mString;
};
Line::Line() {
mString = new std::string("XXXXX...
For example is the following valid?
std::vector<int> vec(5, 0);
std::vector<int>::const_iterator it1(vec.begin());
std::vector<int>::const_iterator it2(vec.begin());
//Use it1 and it2 like they don't know about each other.
Is there a special name for a container that permits multiple active iterators?
...
Is there any way to use the += operator with a vector without using boost or using a derivated class?
Eg.
somevector += 1, 2, 3, 4, 5, 6, 7;
would actually be
somevector.push_back(1);
somevector.push_back(2);
somevector.push_back(3);
etc.
...
ptr_vector is copy constructible and copy assignable. How can it deep copy the underlying objects when it doesn't know their concrete types?
...
Here is a sample code that I have:
void test()
{
Object1 *obj = new Object1();
.
.
.
delete obj;
}
I run it in Visual Studio, and it crashes at the line with 'delete obj;'.
Isn't this the normal way to free the memory associated with an object?
I realized that it automatically invokes the destructor... is this normal?
...
Suppose that I have an array(local to a function) and a pointer
char a[]="aesdf" and char *b="asdf"
My question is whether in the former case the string literal "aesdf" is stored in read only section and then copied on to the local array or is it similar to
char a[]={'a','e','s','d','f','\0'}; ?
I think that in this case the characte...
I'm trying to get MinGW and MSYS working so I can build iconv and libxml2 in Windows, but I'm finding ./configure and make are giving lots of BSD/Unix related errors that aren't specific enough to google, and not descriptive enough for me to figure out. Can anybody go through some of the steps needed to get iconv and libxml2 .dll/.lib b...
Hello guys,
Can some one please tell me an approach for finding security flaws in a given code. For ex: in a given socket program. Any good examples or good book recommendations are welcome.
Thanks & Regards,
Mousey
...
How can I use a c++ template as an a parameter to an objective-c method?
essentially I want to do something like this:
template<typename T>
- (void)method:(T)arg
but that doesn't work. according to this document this is possible however it does not provide any examples. Does anyone know how tot do this?
...
i have following code
#include <iostream>
#include<exception>
#include <cstdlib>
int main(){
for (int i=0;i<100;i++){
std::cout<<i<<" ";
if (i %5==0){
abort();
}
}
return 0;
}
but it only writes 0 and says that abort was called why?i think it should ouput
0 1 2 3 4 and than...
Hi, I come across a very tricky problem with bit manipulation.
As far as I know, the smallest variable size to hold a value is one byte of 8 bits. The bit operations available in C/C++ apply to an entire unit of bytes.
Imagine that I have a map to replace a binary pattern 100100 (6 bits) with a signal 10000 (5 bits). If the 1st byte o...
Hi!
Does anyone have any experience in porting Python code to either C++ or Objective-C?
If so, can you give me some advice on docs or tutorials which my help me?
The Python code I'm hoping to port is mostly non-gui and involves a lot of string manipulation,
regex, and extensions of container datastructures.
Speed is less important.
Bas...
tuple in boost and TR1/c++0x provides a convenient (for the writer of the function) method to return two values from a function--however it seems to damage one major feature of the language for the caller: the ability to simply use the function to initialize a variable:
T happy();
const auto meaningful_name(happy()); // RVO means no exc...
What does line 6 means? I am not understanding what is that, please can anyone elaborate on this?
class A
{
int sz;
double *dptr;
public:
A(int size) : sz(size) {dptr= new double[size];} // line 6
~A(); // line 7
};
A::~A() // line 9
{
delete dptr[]; // line 11
}
...
I have the following code for self learning:
#include <iostream>
using namespace std;
struct bitfields{
unsigned field1: 3;
unsigned field2: 4;
unsigned int k: 4;
};
int main(){
bitfields field;
field.field1=8;
field.field2=1e7;
field.k=18;
cout<<field.k<<endl;
cout<<field.field1<<endl;
cout<<fi...
Hya,
sorry for newbie question , i am trying to create simple circle in VS2010 console c++, also i looked in google but some provides library , some provides source code msoftcon.h etc , but still i am unable to draw a simple circle.The one msoftcon builds successfully but still it doesn't draw a circle just fills up the console window...
Possible Duplicate:
sum of elements in a std::vector
I want to sum the items of a std::vector
For example
std::vector<int > MYvec;
/*some push backs*/
int x=sum(MYVec); //it should give sum of all the items in the vector
How to write sum function?
I have tried this
int sum(const std::vector<int> &Vec)
{
int res...