c++

Compiling c++ program under linux

I am trying to compile simple program under linux. These are the set of operations I performed. [mypc@localhost programs]$ vim heap.cpp [mypc@localhost programs]$ g++ -c heap.cpp [mypc@localhost programs]$ chmod 777 heap.* [mypc@localhost programs]$ g++ -c heap.cpp [mypc@localhost programs]$ ./heap.o bash: ./heap.o: Permission denied...

is there a difference between malloced arrays and newed arrays

I'm normally programming in c++, but are using some clibrary functions for my char*. Some of the manpages like for 'getline', says that input should be a malloced array. Is it ok, to use 'new' instead? I can see for my small sample that it works, but could this at some point result in some strange undefined behavior? I know that a 'n...

How can I make a ball of light in openGL?

I'm trying to make a orb of light (Like a sun) but I can't seem to make it visible at all. I'll give you some snipets of code I have. It's in Java LWJGL, so it might look a little different. private float lightAmbient[] = { 0.0f, 1.0f, 1.0f, 1.0f }; // Ambient Light Values ( NEW ) private float lightDiffuse[] = { 1.0f, 1.0f, 1.0f, ...

QMetaObject::invokeMethod returns true, but method is never called

hello. I'm trying to run a method on the GUI thread using QMetaObject::invokeMethod, which returns true. But, if I use Qt::QueuedConnection my method never gets called (even if invokeMethod returns true). This is what I'm using: QMetaObject::invokeMethod(this, "draw_widgets", Qt::QueuedConnection) I don't get any error messages or an...

How to know defination of a struct in dll ?

I need to use a third party DLL which I don't have header , lib or object file of it just DLL alone, I follow this article "Explicitly Linking to Classes in DLL's" in codeguru and able to user function, c++ class from that DLL but there some function call that need to pass or return a struct like this undecorated function I get from PE E...

Crash at static object destruction

I am working on a 3rd party c++ app. It is crashing during the exit. If I look at the stack all I get is the __static_initialization_and_destruction_0 function and lots of questions marks. Project is huge and unfortunately it has many static objects. Is there any way to find out which one is crashing? ...

Poco MulticastSocket tutorial

Is there any tutorial, that shows, how to work with Poco::Net::MulticastSocket ? ...

How do I create Modal dialog in worker thread(Non-UI thread)?

I have written a sample MFC application in which there are two threads: -Main thread ( UI thread) -Worker thread ( non-UI thread) I have a specific requirement to create a Modal dialog in Non-UI ( worker thread). When I create the CDialog object and call DoModal on the same, it works. The dialog gets created and acts as Modal t...

Random sudoku generation

I'm writing a function that should generate random sudoku puzzles for a simulation project; this funcion takes as argoument the number of cells to generate then it generates the indexes of cells and numbers to put in those cells. I have a problem in generation of cells indexes, I'm not an expert in programming and i can't find a good ro...

What is the difference between ANSI/ISO C++ and C++/CLI?

Created by Microsoft as the foundation of its .NET technology, the Common Language Infrastructure (CLI) is an ECMA standard (ECMA-335) that allows applications to be written in a variety of high-level programming languages and executed in different system environments. Programming languages that conform to the CLI have ...

Cannot export template function

I have a class named "SimObject": namespace simBase { class __declspec(dllexport) SimObject: public SimSomething { public: template <class T> void updateParamValue( const std::string& name, T val ); } } I have another class named "ITerrainDrawable": namespace simTerrain { class __decls...

A way to load DLL from central repository

Hi, We have lot of products and there are some common DLLs across each product's application. Right now we copy each common DLL into each product's bin directory and treat them as private assembly. This unnecessarily increase the msi size of each product and when a problem occurs in a DLL we have to build each product's msi comprising t...

OutlookExpress IStoreNamespace GetFirstSubFolder method fails on WinXP x64

HRESULT error code - MSOEAPI_E_INVALID_STRUCT_SIZE Works fine on WinXP x32. ...

How to get details about the selected items using QTreeView?

Hello, I'm using QTreeView with QDirModel like this: QDirModel * model = new QDirModel; ui->treeView->setModel(model); ui->treeView->setSelectionMode(QTreeView::ExtendedSelection); ui->treeView->setSelectionBehavior(QTreeView::SelectRows); This works fine, however, I'm not sure how to get the details about the files I select. I've got...

Problem with reading data into structs using a C casting method

Hi, I'm writing an MD3 model loader in C++ and I understand the file format and what I need to do but I can't seem to get the syntax right. I have a class for the model and within that class there are a set of structs which will have the model data read into them. In the implementation of the class there is a constructor which reads da...

Getting a handle to the processes main thread

I have created an additional thread in some small testing app and want to suspend the main thread from this additional thread. The additional thread is created via CreateRemoteThread from an external process. Since SuspendThread needs a HANDLE to the thread which should be suspended, I want to know how to get this HANDLE from code runni...

c++ float to bool conversion

I'm looking at some 3rd party code and am unsure exactly what one line is doing. I can't post the exact code but it's along the lines of: bool function(float x) { float f = doCalculation(x); return x > 0 ? f : std::numeric_limits<float>::infinity(); } This obviously throws a warning from the compiler about converting float->bool, but ...

Static analysis tool to detect ABI breaks in C++

It's not very hard to break binary backwards-compatibility of a DSO with a C++ interface. That said, is there a static analysis tool, which can help detecting such ABI breaks, if it's given two different sets of header files: those of an earlier state of the DSO and those of the current state (and maybe DSOs as well)? Both free and comme...

How to turn Sequence of images into video using DirectShow filters?

How to turn Sequence of images into video using DirectShow filters? I have image A and image B and image C. I want to create a DirectShow graph (Using GraphEdit or with C\C++\C# for example) to create a video of 3 frames in duration where first frame is image A second image B and so on =) How to do it? ...

How to create a DirectShow graph which would wait for incoming images and add them as frames into video file?

How to create a DirectShow graph which would wait for incoming images and add them as frames into video file? Using GraphEdit or with C\C++\C# So I want to have a graph which would work and wait for images incoming into him in any way you think is most easy (for example We can have a folder from where DSfilter would be able to take ima...