c++

boost doxygen documentation

hello I have been trying to generate doxygen documentation for boost, as a way to browse source tree and have man documentation. However, doxygen has been running for past week or so on IBM power5, and I have no idea how much longer (right now I am on boost_1_43_0/boost/mpl/). Is there prebuilt doxygen documentation, if not, is there a...

how to close specific serial port in C++ MFC smart device application?

how to close specific serial port in C++ MFC smart device application? how to check if a port is open? and how to close it? i am using this " ex: http://msdn.microsoft.com/en-us/library/ms881795.aspx ...

Portable C++ build system

I'm looking for a good and easy in maintenance portable build system for C++ projects. Main platforms should include Windows (Visual Studio 8+) and Linux (gcc); Cygwin may be an advantage. We're considering two main possibilities: CMake and Boost.Jam. SCons can be also an option, but I haven't investigated it yet. CMake and Boost.Jam see...

[C/C++] Linking Problems

I've tried this on Linux and Windows... I've used C and C++... I've tried with wxWidgets, gtkmm, glfw and GTK+. I've tried with various IDE's and so on. (I managed to get GLFW to work fine at one point) My problem is I am somehow not linking libraries properly. However I cannot find out which library isn't linked because the errors are ...

C++ Circularly declaring Preprocessor directives? Or defines before includes?

I'm a bit new to C++, so bear with me. I'm trying to figure out where exactly to place my #defines and #includes in my project. I have something like this: main.h #include "other.h" #define MAX_GROUPS 100 struct Cat { int something[MAX_GROUPS]; } In other.h I also need to use MAX_GROUPS, so do I also define MAX_GROUPS in other....

ERROR_DEV_NOT_EXIST when ::CreateFile in C++ MFC?

Hi, I am writing to open a port using this function: HANDLE hFile = ::CreateFile(pszComName, GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0,0); // Check if we could open the device if (hFile == INVALID_HANDLE_VALUE) { DWORD hh= ::GetLastError(); error.Format(_T("test - [%d]"),hh); AfxMessageBox(error,MB...

How to export symbols in dylib release in xCode 3.2.3 (GCC 4.2)

All symbols where exported in previous version of xcode but now we have upgraded to OS X 10.6.4 and xcode 3.2.3. So, in debug xcode property Fix & Continue is enabled which causes all symbols to export but in release its disabled and now while linking to this dylib we get undefined symbol error. I tried to add exported symbol file but do...

Call main thread callback function from worker thread

Scenario: I have a c++ DLL. In this DLL, I created a worker thread. In the worker thread, I have a loop that waits for user input via a USB hardware device. The loop ends only when the user input on USB device meets some criteria. Additionally, I need to feedback the user usage feedback of the USB device real-time to display on screen. I...

how to "return an object" in C++

Hello, I know the title sounds familiar as there are many similar questions, but I'm asking for a different aspect of the problem (I know the difference between having things on the stack and putting them on the heap). In Java I can always return references to "local" objects public Thing calculateThing() { Thing thing = new Thing(...

Datatype convertion problems

Hi all, some days ago i've posted a question for a win32 API stacktrace implementation with MSYS/Mingw: http://stackoverflow.com/questions/3318564/win32-api-stack-walk-with-mingw-msys The hint with the explicit loading of the dll was the correct solution. So i've restart the try to implement a stacktrace using the win32 CaptureStackBac...

Templates .?Any one explain this ?

A non-exported template that is neither explicitly specialized nor explicitly instantiated must be defined in every translation unit in which it is implicitly instantiated; no diagnostic required. Can any one explain this? actual point is from ISO standard 14th chapter 14.0 ,point 8 ...

A warning with cppcheck, "hides typedef with same name"

This is a cppcheck warning message. Variable 'BUFFER_INFO' hides typedef with same name The BUFFER_INFO is defined as following. typedef struct tagBufferInfo { CRITICAL_SECTION cs; Buffer* pBuffer1; Buffer* pBuffer2; Buffer* pLoggingBuffer; Buffer* pSendingBuffer; }BUFFER_INFO, *PBUFFER_INFO; And I wrote, PBUFF...

Pointers concept

In C++, what is the difference between: void func(MyType&); // declaration //... MyType * ptr; func(*ptr); // compiler doesnt give error func(ptr); // compiler gives error i thought & represents memory address so // this statement should correct as ptr is only a pointer // or address of some real var. ...

C/C++ memory footprint, per source file

In C programming, is there any way to determine how much a single source code file contributes to the final memory footprint? Let us assume a simple C-program consisting of source files test1.c, test2.c, test3.c, and so on. The environment is Linux and the complier gcc. With objdump and readelf can be seen see the total footprint and h...

How to load a string from the resource of a different process?

I need to load a string which is placed in the resource dll of a different process, provided that the process will be running at the time of call. I tried following code - HMODULE hRes = ::LoadLibrary(_T("SomeResource.dll")); TCHAR buffer[50]; ::LoadString(hRes, IDS_SOME_ID, buffer, 50); This code is working fine while r...

How to correctly fix "zero-sized array in struct/union" warning (C4200) without breaking the code?

I'm integrating some code into my library. It is a complex data structure well optimized for speed, so i'm trying not to modify it too much. The integration process goes well and actually is almost finished (it compiles). One thing is still bothering me. I'm getting the C4200 warning multiple times: warning C4200: nonstandard extension ...

When is a shallow copy desirable (instead of a deep copy)?

Can someone give an example of a situation where a shallow copy is needed? Note that in some situations, shallow copy and deep copy are the same. This can happen when the object has no ownership over any of its subvariables; that is, all subvariables are aggregated. I'd like to see examples where the an object is composed from variables...

Remove_if predicate for list

why won't this work when i use template function predicate. class A { int x; public: A(int X):x(X){} int getX() const {return x;} }; template <typename T> bool less_than_two(T const &a) { return (a.getX()<2); } int main() { list <A> l; for (int i = 0; i < 5; i++) l.push_back(i); l.remove_if(less_t...

va_list create dynamically.

All: I have faced such a problem. I have a function void foo(int cnt, va_list ap); I need to use it, and but requirement is quite strict, number of va_list vary and it will change during run-time. What I would like to do is: create a va_list (which expects char*) form QList<Contact*> where Contact is a defined class class Cont...

Debug C++ code in visual studio from python code running in eclipse

Does any one know how we can do this? I have python code in eclipse and whenever it calls c++ functions, i want the break point to go to the visual studio c++ project. ...