c++

Converting VS2008 to VS2010 project "cannot find the file specified"

Hello, I am trying to upgrade a Visual C++ 2008 project to a Visual C++ 2010 project. However, when I attempt to do so, I receive the following error: The following error has occurred during XML parsing: File: C:\Documents and Settings\t-aruns\Documents\Visual Studio 2008\Projects\test\test\test.vcproj Line: 9 Column: 2 Error Message: ...

How to fix error with sample code for MFC tooltips?

I get this error when compiling the following source from here: Error 1 error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CStaticLink::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)' e:\development\tooltips\cqa0311\statlink.cpp 28 The line of code is for the ON_WM_NCHITTEST below BEGIN_MESS...

a C++ learning book around the Qt Framework

Hello, i wish to migrate to C++ , having a more or less concrete C# & .NET Background. I Want to escape from the shackles of the .NET Environment [THE FRAMEWORKS] but don't feel like starting the learning process from scratch (the OO P introductions, types etc...) so I'm looking for a book that skips some of that and is centered around Q...

SQLite copy database destroyed original, Why?

Hello I got this code snippet to copy a file database to a memory database. it works but it destroys the original file database. (By destroys I mean sets the file size to zero) /** * Exec an sql statement in values[0] against * the database in pData. */ int process_ddl_row(void * pData, int nColumns, char **values, char **columns)...

Is there any way to deduce link flags from headers ?

Let's say I know that some of my C/CPP files include certain headers - is there any reliable information against which libraries I will have to link, other than guessing ? For example, if I have something like #include "foo.h" and want to find libfoo_abcdef_123.so Is there any 'best practice' how to do that, any place where to lo...

sending more than integer to the C++ function as parameter

Possible Duplicate: Passing a constant array to a function in C/C++ void Bar (int *values) {} void Foo () { int values[3] = { -5, 2, 8}; Bar (values); } But i want something like the following. How can i make this possible? void Foo () { Bar ({5,2,8}); //error C2143: syntax error : missing ')' before '{' } ...

communication between two computers with 2 c++ programs

Hello smart people, I have one computer that is running a c++ program to control a robot and another computer that is running a computer vision system (also written in c++). I would like for these two programs to be able to talk to one another. The communication would not have to be complex, I would just need the robot computer to be ab...

Adding methods to template specialization

I have a templated C++ class that exposes a number of methods, e.g template<int X, int Y> class MyBuffer { public: MyBuffer<X,Y> method1(); }; Now, I want to expose additional methods to this class if X == Y. I have done this by subclassing MyBuffer, template<int X> class MyRegularBuffer : public MyBuffer<X,X> { public: MyRe...

Conditional Compile using Boost type-traits

I have a template that I would like to conditionally compile depending on the type of the argument. I only care about differentiating between "Plain Old Data" (POD), i.e., integers, etc or classes/structs. I'm using c++ VS2008 on Windows. template<T> class foo { void bar(T do_something){ #if IS_POD<T> do something for ...

How can I query remembered UNC connections similar to "net use"?

I understand how to retrieve the UNC path for a mapped drive from the registry (HKEY_CURRENT_USER\Network), but I also have a need to retrieve remote connections to network resources that were not mapped. For example, opening the 'Run' dialog and typing <\server0123\share$>. If I type "net use", I would see this mapping, but I have bee...

Inline speed and compiler optimization

Hey guys, I'm doing a bit of hands on research surrounding the speed benefits of making a function inline. I don't have the book with me, but one text I was reading, was suggesting a fairly large overhead cost to making function calls; and when ever executable size is either negligible, or can be spared, a function should be declared inl...

What is wrong with this recursive va_arg code?

Hi, I'm trying to make a generic function taking a variable argument list. A part of the design is that some of these functions call each other. Unfortunately it doesn't seem to work. As you can see if you run the simple code below, the call to command() always fails, but the direct call to marshal_size() succeeds in decoding the two st...

C++ iterator, do I need to reset after using set find method

Should I need to call reset method or anything, when I try to use c++ stl set find method multiple times? ...

How to design multithreaded application

I have a multithreaded application. Each module is executed in a separate thread. Modules are: - network module - used to receive/send data from network - parser module - encode/decode network data to internal presentation - 2 application module - perform some application logic on the above data one after other - counter module - used t...

How to write a program that uses user input and tests for the end of file function

I am writing a program that takes letters and converts them to telephone numbers. I am just starting out in c++ and not really familar with classes or members which most of the examples I've seen on the web involve these concepts. I have the switch case portion working but cannot get the end of file part right. I have copied my code belo...

C++: Error C2064 with STL

I'm trying to use STL, but the following doesn't compile. main.cpp: #include <set> #include <algorithm> using namespace std; class Odp { public: set<int> nums; bool IsOdd(int i) { return i % 2 != 0; } bool fAnyOddNums() { set<int>::iterator iter = find_if(nums.begin(), nums.end(), &Odp::IsOdd...

Multi-dimensional array and pointers in C++?

int *x = new int[5](); With the above mentality, how should the code be written for a 2-dimensional array - int[][]? int **x = new int[5][5] () //cannot convert from 'int (*)[5]' to 'int **' In the first statement I can use: x[0]= 1; But the second is more complex and I could not figure it out. Should I use something like: x[0]...

std::list remove calling delete on pointer?

I ran valgrind on my program because of a segfault I can't figure out. It detected a problem here... Address 0x75c7670 is 0 bytes inside a block of size 12 free'd at 0x4024851: operator delete(void*) (vg_replace_malloc.c:387) by 0x805F6D8: std::list<Object*, std::allocator<Object*>::remove(O bject* const&) (new_allocator.h:95) T...

Why does this template have an error in Xcode but not Visual Studio?

I am getting an error in Xcode when using templates in C++. Can someone tell me what is wrong? The first version reports an error in Xcode, but not in Visual Studio. // Version 1: Error in Xcode, but not Visual Studio template<typename LengthT, typename VertexT> int MyGraphAlgorithm(...arguments omitted...) { using namespace boost; ...

Reading and writing to USB (HID) interrupt endpoints on Mac

I am attempting to communicate with a rather specific USB device and developing both Windows and Mac code to do so. The device is a USB device with a HID interface (class 3) with two endpoints, an interrupt input and an interrupt output. The nature of the device is such that data is sent out from the device on the input endpoint only...