c++

[c++] [windows] back linking.

Hi all. There is shared class. Declarator is in shared header, implementation is in main program. Main program load DLL and exec some function from it, function create object of shared class. Test code: shared_header.h: #include<stdio.h> class sharedClass{ public: sharedClass(); }; plugin.cpp -> libplugin.dll #include"shared_head...

Copy to Program Files under Windows Vista/7

Hi, I have written a wizard in c++ which installs some files to the program files folder under windows. As I understand, I need Admin rights to write to program files under Vista/7. So my question is: Is there a way to turn on Admin rights while the application is running respectively only for one wizard page? Or do I have to start anot...

Can a C++ Class Constructor Know Its Instance Name?

Is it possible to know the object instance name / variable name from within a class method? For example: #include <iostream> using namespace std; class Foo { public: void Print(); }; void Foo::Print() { // what should be ????????? below ? // cout << "Instance name = " << ?????????; } int main() { Foo a, ...

What kind of message can be transported through ActiveMQ?

We are building a distributed system, maybe a c# app will talk to a c++ app, and maybe some jpeg image will ben send between, is this possible with Activemq? ...

Can a reference type be used as the key type in an STL map

Can I construct an std::map where the key type is a reference type, e.g. Foo & and if not, why not? ...

How to build a SAFEARRAY of pointers to VARIANTs?

I'm trying to use a COM component with the following method: HRESULT _stdcall Run( [in] SAFEARRAY(BSTR) paramNames, [in] SAFEARRAY(VARIANT *) paramValues ); How can I create in C/C++ the paramValues array? ...

Mysql++ "undefined reference to __imp___ZN7mysqlpp10ConnectionC1Eb"

I am trying to install the mysql++ in Code::Blocks, but When I try to run the example code I get this error: undefined reference to __imp___ZN7mysqlpp10ConnectionC1Eb What I am doing wrong? ...

How to link to VS2008 generated .libs from g++

I am trying to build a dll using mingw g++ under cygwin. I have .h files that refer to objects exported by a .dll that was build using MS Visual Studio 2008. I link to the .lib generated with that .dll. When I run g++ I get lots of errors like this /cygdrive/c/dev/blox/ulfx/ulfx/JavaInterface.cpp:206: undefined reference to `__imp___Z...

Get stack trace from uncaught exception?

I realise this will be platform specific: is there any way to get a stack trace from an uncaught C++ exception, but from the point at which the exception is thrown? I have a Windows Structured Exception Handler to catch access violations, etc. and generate a minidump. But of course that won't get called in the event of termination due t...

predeclaration in c++

I have a program for distance vector routing as shown below (though, what the program is for is not important here). The problem is when I run this program using Turbo C++ compiler on Windows, it works perfectly fine. But when I compile this using gcc on Fedora 9 (as you can see the 'r' I have used in the function build of the 'router' ...

CMake linking problem

I am trying to use CMake to compile a C++ application that uses the C library GStreamer. My main.cpp file looks like this: extern "C" { #include <gst/gst.h> #include <glib.h> } int main(int argc, char* argv[]) { GMainLoop *loop; GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink; GstBus *bus; /* Initialisation ...

Class Identifier used inside the class declaration. Is it a good practice?

While reviewing one of our C++ class through coverity, it showed an error message on a particular class. The class is as follows: class InputRecord { /* Construtor */ ... InputRecord::RejectRecord(); ... /* Destructor */ } What is the significance of using an identifier inside the class? Is it a good practice to fo...

index or position in std::set

I have a std::set of std::string. I need the "index" or "position" of each string in the set, is this a meaningful concept in the context? I guess find() will return an iterator to the string, so my question might be better phrased as : "How do I convert an iterator to a number?". ...

Member assignment in a const function

I have a class member myMember that is a myType pointer. I want to assign this member in a function that is declared as const. I'm doing as follows: void func() const { ... const_cast<myType*>(myMember) = new myType(); ... } Doing this works fine in VC++, but GCC gives an error with the message "lvalue required as left ...

How to use std::wstring with std::istringstream?

I am trying to write a template function which will extract the value of the given datatype from the given string. I came up with something like this: template<class T> static T getValue(const CString& val_in) { std::wstring value = val_in; std::istringstream iss; iss.str(value); T val = T(); iss>>va...

Compile issues based on different platforms

I'm compiling a solution which runs fine on the PC but when trying to compile it for a different platform I get the following error: "Unhandled Exception: System.ArgumentException: An item with the same key has already been added." Anyone know what it could mean? ...

Is there any C++ code beautifuler plug-in for eclipse ?

hi, I found a very tempting function in Netbeans, which is to re-factor or 'beautiful-ize' the c++ code according to some parameters, such as tab length, {'s position, etc is there anything similar in Eclipse, which keyword should I google? ...

Programmatically differentiating between USB Floppy Drive and USB Flash Drive in Windows

On Windows (XP-7), is there a reliable way of programatically differentiating between USB floppy drives and USB flash drives in C++? At the moment, I'm using WMI to get updates when new Win32_LogicalDisk instances are detected, and then using the DriveType attribute of the LogicalDisk object to figure out a basic type. This works quite ...

Implementing a File Object (C++)

I've been looking over the Doom 3 SDK code, specifically their File System implementation. The system works (the code I have access to at least) by passing around an 'idFile' object and I've noticed that this class provides read and write methods as well as maintaining a FILE* member. This suggests to me that either the FILE* is 'o...

virtual function - vtable

Let's say I have class A who inherits from class B and C (multiple inheritance). How many vtable members class A would have ? What's the case in single inheritance ? In addition, suppose: Class A : Public B {} and: B* test = new A(); Where does test gets its vtable from? What's assignment? I assume it gets B's part of A's vtabl...