c++

GNU C++ how to check when -std=c++0x is in effect?

My system compiler (gcc42) works fine with the TR1 features that I want, but trying to support newer compiler versions other than the systems, trying to accessing TR1 headers an #error demanding the -std=c++0x option because of how it interfaces with library or some hub bub like that. /usr/local/lib/gcc45/include/c++/bits/c++0x_warning....

Call c++ library from c#

Hello All, This question might seem a repeat of previous ones. I have read through a series of posts, but not completely clear for my situation. I have a c++ library which is created using momentics IDE. I have to be able to use this library into a c# project. Someone had been working on this project before being handed over to me. Cu...

gcc -Wshadow is too strict?

In the following example: class A { int len(); void setLen(int len) { len_ = len; } // warning at this line int len_; }; gcc with -Wshadow issue a warning: main.cpp:4: warning: declaration of `len' shadows a member of `this' function len and integer len are of different type. Why the warning? Update I see there's a w...

Loop doesn't update listboxes until it is done iterating

I have a loop that takes file name from a listbox, performs a system() call, then moves that filename to another listbox. Problem is, it doesn't move the filenames over one at a time, but waits until the entire loop is finished and moves them all at once. What would I do to get it to perform how I want it to? the loop: for each( String...

seemingly complex date time calculations...

I have this function that should convert them from Ole to UTC8601 standard, but I don't understand how the integer representations of time seem to work. Can anyone give me some explanation? the function is called: RipOf_AfxTmFromOleDate containing statements as: nDaysAbsolute %= 146097L; Where does the value come from and how is it c...

Event Log Oldest Record Number

I'm trying to use the new event log API to get the oldest record number from a windows event log, but cannot get the the API to return the same answer as event viewer displays (looking at the details EventRecordID). Some sample code I'm using is below: EVT_HANDLE log = EvtOpenLog(NULL, _logName, EvtOpenChannelPath); EVT_VARIANT buf; DW...

What are the pitfalls of ADL?

Some time ago I read an article that explained several pitfalls of argument dependent lookup, but I cannot find it anymore. It was about gaining access to things that you should not have access to or something like that. So I thought I'd ask here: what are the pitfalls of ADL? ...

Copy constructor

Possible Duplicate: Why should the copy constructor accept its parameter by reference in C++? Why the argument to a copy constructor is passed by reference? ...

Recommended migration strategy for C++ project in Visual Studio 6

For a large application written in C++ using Visual Studio 6, what is the best way to move into the modern era? I'd like to take an incremental approach where we slowly move portions of the code and write new features into C# for example and compile that into a library or dll that can be referenced from the legacy application. Is thi...

C++ vector insights

Hi, I am a little bit frustrated of how to use vectors in C++. I use them widely though I am not exactly certain of how I use them. Below are the questions? If I have a vector lets say: std::vector<CString> v_strMyVector, with (int)v_strMyVector.size > i can I access the i member: v_strMyVector[i] == "xxxx"; ? (it works, though why?) ...

What is the nicest way to parse this in C++ ?

Hi, In my program, I have a list of "server address" in the following format: host[:port] The brackets here, indicate that the port is optional. host can be a hostname, an IPv4 or IPv6 address (possibly in "bracket-enclosed" notation). port, if present can be a numeric port number or a service string (like: "http" or "ssh"). If p...

What is this conversion called?

Is there a name or a term for this type of conversion in the c++ community? Has anyone seen this conversion be referred to as "implicit conversion"? class ALPHA{}; class BETA{ public: operator ALPHA(){return alpha;} private: ALPHA alpha; }; void func(ALPHA alpha){} int main(){ BETA beta; func(beta); ...

Grab OpenGL output of an application from another application

Hi! i would like to know if it's possible, in c/c++, to launch an application and grab it's standard video output? The goal of this would be to grab the buffer of an application, and use it as a texture for a grid of vertex with special texture coordinate (in order to project it in a FullDome)? I'm developing under Linux. Thnaks! ...

C++ memcpy from double array to float array

Is is possible to memcpy from a double array to a float array safely? ...

Extract a C/C++ header file from a C# class exposed to COM

I'm not sure I've setup everything I've needed to in my C# class to properly, but it does work in COM. I've been looking for an example of a C# class that was successfully used in a C/C++ project, but haven't come across anything. I've tried using the OLE/COM Object View app to open the .tlb file and save as .h, but it gives some errors...

Is there any C\C++ Cross-platform library for sharing data between app's?

Is there any C\C++ Cross-platform library for sharing data between app's? ...

Setting Environment Variables For NMAKE Before Building A 'Makefile Solution'

I have an MSVC Makefile Project in which I need to set an environment variable before running NMAKE. For x64 builds I needs to set it to one value, and for x86 builds I need to set it to something else. So for example, when doing a build I would want to SET PLATFORM=win64 if I'm building a 64-bit compile, or SET PLATFORM=win32 if I'm b...

C++ Adding 2 arrays together quickly

Hello! Given the arrays: int canvas[10][10]; int addon[10][10]; Where all the values range from 0 - 100, what is the fastest way in C++ to add those two arrays so each cell in canvas equals itself plus the corresponding cell value in addon? IE, I want to achieve something like: canvas += another; So if canvas[0][0] =3 and addon[0...

Linking Error Building 64bit Qt app on 32bit XP machine.

I'm trying to build a 64 bit version of my application (and yes I really do need the memory) on my 32bit xp dev box for production testing on our Vista64 server. Previously, I have built w/o any errors the Qt 4.6.2 DLL's in 64 bit mode. That step went vary smooth. Just to get started in building production, I'm trying to rebuild Qt'...

c++ Function pointer inlining

I know I can pass a function pointer as a template parameter and get a call to it inlined but I wondered if any compilers these days can inline an 'obvious' inline-able function like: inline static void Print() { std::cout << "Hello\n"; } .... void (*func)() = Print; func(); Under Visual Studio 2008 its clever enough to get it dow...