c++

Can I build and debug c++ programs on remote machine ??

I am on windows XP want to build the programs on linux remote pc i have eclipse Ganymede, CDT, RSE installed on remote machine... but how to configure all this? am I doing correct? could anybody suggest ...

Can func get the lineno who call itself? (C/C++)

Hi, I've a problem , as the following code discribe itself. 1 #include<stdlib.h> 2 #include<stdio.h> 3 void log() 4 { 5 printf("Log [Line:%d]\n",__LINE__); 6 } 7 int main() 8 { 9 log(); 10 log(); 11 } The expected result is Log [Line:9] Log [Line:10] But, the fact is Log [Line:5] Log [Line:5] No su...

Why doesn't free(p) set p to NULL?

Any reasons why this can not be standard behavior of free()? multiple pointers pointing to the same object: #include <stdlib.h> #include <stdio.h> void safefree(void* p = NULL; } int main() { int *p = (int *)malloc(sizeof(int)); *p=1234; int* printf("p=%p p2=%p\n", p, p2); safefree((void* printf("p=%p p2=%p\n"...

A simple hello world NPAPI plugin for Google Chrome?

I am trying to make a chrome plugin but Chrome API doesn't give me enough power. I want to use NPAPI but I have no idea how to use it but I do have experience in Visual C++. Can someone show me a 'Hello world' in C++ application so I can get started? ...

How to get the quickfix timestamp?

I've seen in quickfix doxygen documentation that it generates an utc timestamp as soon as it has received a FIX message from a socket file. Have a look in ThreadedSocketConnection::processStream(), it calls then m_pSession->next( msg, UtcTimeStamp() ); I would like to get that timestamp, because I need it to screen network and QuickF...

Compile time Meta-programming, with string literals.

I'm writing some code which could really do with some simple compile time metaprogramming. It is common practise to use empty-struct tags as compile time symbols. I need to decorate the tags with some run-time config elements. static variables seem the only way to go (to enable meta-programming), however static variables require global d...

Difference between a virtual function and a pure virtual function

Possible Duplicate: C++ Virtual/Pure Virtual Explained Hi, Need to know what is the difference between a pure virtual function and a virtual function? I know "Pure Virtual Function is a Virtual function with no body" but what does this mean and what is actually done by the line below virtual void virtualfunctioname() = 0 ...

Bizarre C++ compiler problem

Hi, I have the following C++ code: typedef istream_iterator<string> isi; // (1) vector<string> lineas(isi(cin), isi()); // (2) //vector<string> lineas; //copy(isi(cin), isi(), back_inserter(lineas)); typedef vector<string>::iterator vci; for (vci it = lineas.begin(); it != lineas.end(); ++it) cout << *it << endl; However, I get...

Problem porting boost 1.33.1 programm to boost 1.42.0

i've got a variable: boost::program_options::options_description m_corbaDesc; and the following is done with it m_corbaDesc.add_options() ("corba", boost::programm_options::parameter("<options+>", &m_corbaOptions), "CORBA -ORBInitRef options") ("corba-ns", boost::program_options::parameter("<name:port>", &m_corbaNameService),...

Differences in variable declarations in C++

Class A { }; What is the difference between A a , A* a and A* a = new A(). ...

How to restore data on Power Failure using C++ programming on windows.

Hi, In my program I am writing a file of my programs states. I am writing the file many times to the file during the program run, because the program changes some variables that that i need to store very frequently. Now, if , for some reasons my power fails. Then most of the time I loose data in that file. Please, tell me any mechanis...

News feed APIs for general news

I'm building a database + tool that scours news feeds for a certain term. For example "food poisoning from nuts". I want to scour social media sites, news sites, major news aggregators, etc... for that term. Question 1: What are some of the news aggregator APIs out there? Question 2: How Would you go about coding and receiving only the...

How to detect unresolved symbol when creating a library ?

Hello everyone, Under Solaris 10, I'm creating a library A.so that calls a function f() which is defined in library B.so. To compile the library A.so, I declare in my code f() as extern. Unfortunately, I "forgot" to declare in A's makefile that it has to link with B. However, "make A" causes no warning, no error, and the library A.so i...

Could this C cast to avoid a signed/unsigned comparison make any sense?

I'm reviewing a C++ project and see effectively the following: std::vector<SomeType> objects; //then later int size = (int)objects.size(); for( int i = 0; i < size; ++i ) { process( objects[i] ); } Here's what I see. std::vector::size() returns size_t that can be of some size not related to the size of int. Even if sizeof(int) ==...

C++: inheritance problem

It's quite hard to explain what I'm trying to do, I'll try: Imagine a base class A which contains some variables, and a set of classes deriving from A which all implement some method bool test() that operates on the variables inherited from A. class A { protected: int somevar; // ... }; class B : public A { public: bool ...

Sort data in GtkTreeView non-alphabetically?

I'm trying to sort a column of data in a GTK tree view non-alphabetically. I can't seem to find a function in the GTK+ libraries that cant do such a thing. Does anyone here know of a way to do this? UPDATE: Below is the code im currently trying to use: column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, "Mem...

How to find which thread caused SEGFAULT in a post-mortem gdb session?

Hi, In my application I handle SIGSEG to produce a backtrace and call abort() to generate a core dump. If I now run a gdb-post-mortem analysis of the core, the thread which caused the SEGFAULT is no longer visible. Is there anything I can do so I see the cause for the SEGFAULT? Best regards, Martin ...

Basic question on c++ header file inclusion ?

What are the differences between below 3 programs ?. Is <iostream> a header file or C++ standard library ? 1. #include<iostream> using namespace std; int main() { return 0; } 2. #include<iostream> int main() { return 0; } 3. #include<iostream.h> int main() { return 0; } Thanks in advance. ...

How to get size and location of a control placed on a dialog in MFC?

I've got the pointer to the control with function CWnd* CWnd::GetDlgItem(int ITEM_ID) so i've got CWnd* pointer which points to the control, but simply can't find any method within CWnd class that will retrieve the size and location of a given control. Any help? ...

derived class as default argument g++

Please take a look at this code: template<class T> class A { class base { }; class derived : public A<T>::base { }; public: int f(typename A<T>::base& arg = typename A<T>::derived()) { return 0; } }; int main() { A<int> a; a.f(); return 0; } Compiling generates the following error message in g++: test.cpp: In func...