c++

How do I diagnose problems in loading a gstreamer plugin?

Hi, I have created a gstreamer plugin with an element inside that would generate some data when put in a pipeline (by following the GStreamer Plugin Writer's Guide). My problem is that I cannot load my plugin in a test application. When I call gst_element_factory_make("myextractor", NULL) the result is always NULL. More data (I'm not ...

strange catch clause... C++

What is this catch clause?? STD_CATCH_ALL_with_kMETHODID(...) Its used in a python interpreter extension... ...

PostThreadMessage to another process

I want to post a message to a thread that is running as another process (in particular as a windows service). I've read the documentation for PostThreadMessage but there are some things unclear for me. How do I get a handle for my service's thread? The system only does marshalling for system messages (those in the range 0 to (WM_USE...

Modify in place the elements of a vector

The following doesn't work as desired (print 2) because, I guess, the nodes are passed by value even though the vector is passed by reference. How could I fix it? #include <iostream> using std::cout; using std::endl; #include <vector> using std::vector; class Node{ public: int value; Node(int); void createC...

Simple question about #import

Is #import or #include a job that is handled by the complier or by the linker? ...

calling class-specific operator new

The expression operator new(sizeof(T)) allocates T bytes via ::operator new, correct? Is there any way to call the class-specific version of operator new if it exists, exactly the way how new T() allocates memory (before calling the constructor)? T::operator new(sizeof(T)) gives a compile-time error if T does not define operator new, e...

Start of execution

Please, tell me from where execution starts in c++, hope your answer is "from main". Then what about this? class abc { public: abc() { cout<<"hello"; } }; const abc obj; int main( ) { cout<<"Main"; } output: helloMain Please elaborate. ...

C++ Logging Library recommendation

I'm looking to replace a homebrew "logging" library with something more powerful/portable. I've found John Torjo's "Boost Logging library", but it seems to have been rejected as part of Boost, which is a little disconcerting. What other options are available? ...

Caching the end iterator - Good idea or Bad Idea?

Generally speaking is it a good idea to cache an end iterator (specifically STL containers) for efficiency and speed purposes? such as in the following bit of code: std::vector<int> vint; const std::vector<int>::const_iterator end = vint.end(); std::vector<int>::iterator it = vint.begin(); while (it != end) { .... ++it; } Under...

Changing ECC code of a block

Hi , can I change the ECC code for a block of a file stored on a flash drive by any means ? of a file stored on a HDD (though I don't think there would be a difference between the two) Maybe , through some hardware interrupts or anything like that? Also I need the solution to be in C/C++. ...

Does STL and vector provide sort option?

Hi, Does STL and Vector provide the default sorting option?. ...

C++ winsock error

Hello , i have a simple server that accepts clients. The client connect to the server. The first thing the server will do the following: grab the client socket create a thread for client call ::recv(); the problem here is that recv returnes -1 WSAGetLastError returnes WSAENOTSOCK: (Socket operation on nonsocket.) Microsoft: "An oper...

How to create Handler

Add next changes: Emily::oSeMac^ Terminal; Emily::AsyncSocketController^ _socketManager; delegate void DataArrival(String^, array<unsigned char, 1>^, System::Net::IPEndPoint^); void _socketManager_onDataArrival(String^ SocketID, array<unsigned char, 1>^ SocketData, System::Net::IPEndPoint^ RemoteIP) { System::Ob...

copy constructor is not called??

class X { int i; public: X(int m) : i(m) {}; X(const X } const X opearator++(X X b(a.i); a.i++; return b; } void f(X a) { } }; int main() { X a(1); f(a); a++; return 0; } Here when function 'f' is called copy constructor is getting called as expected. In case of a++, operator++ functio...

c++ qt taskbar menu action

hello, i got this code in qt creator; int main( int argc, char* argv[] ) { QApplication oApp( argc, argv ); QAction *action1; QMenu menu; QSystemTrayIcon TrayIcon( QIcon("favicon.ico") ); TrayIcon.show(); action1= new QAction("action1", NULL); action1->setStatusTip("Create a new file"); menu.addAction(bf2142); TrayIcon.setC...

Access private variable in global scope

For a school assignment I have to find a solution to the following problem; In this below code, the foo function in the global scope tries to access the private variables of a Box, which ofcourse doesn't work. I have to make the foo function work with one line of code at the place show code. #include <iostream> using namespace std; c...

Build a Cross Compiler

I'm trying to compile a c++ file and generate an asm or s file to be disassembled and run in PSIM. Whenever I try to do this I get errors. I am attempting to compile to mipsI-linux. I think I've determined that my cross compiler that was given to me is not working correctly for some reason. Can anyone give me some help building a new cro...

Finite State Machine parser

I would like to parse a self-designed file format with a FSM-like parser in C++ (this is a teach-myself-c++-the-hard-way-by-doing-something-big-and-difficult kind of project :)). I have a tokenized string with newlines signifying the end of a euh... line. See here for an input example. All the comments will and junk is filtered out, so I...

How to redefine a macro using its previous definition

Suppose I have the following macro: #define xxx(x) printf("%s\n",x); Now in certain files I want to use an "enhanced" version of this macro without changing its name. The new version explores the functionality of the original version and does some more work. #define xxx(x) do { xxx(x); yyy(x); } while(0) This of course gives me red...

CUDA: VFW - CODEC DLL

Hello there, my english is not very good and i am sorry for that. I have a video codec project for windows(C++), based on VFW interface. It compiles into dll, setups and runs succesfully. What i want is to add cuda kernel functions to force/improve some algorithm steps. I have installed SDK,Toolkit and Wizard. Applied CUDA rule to p...