OK, I admit I dont know anything abt linking. This is the question I have.
Say I just have the .so file of another C++ program and dont have access to the source code (.h or .cpp). How do I inherit a class in my current program just by linking the .so file?
First of all, is it possible?
This is the situation I was in in the above post.
I tried to compile my program using :
g++ -shared...
User Profile
Collapse
-
C++ shared objects
I have written a program which inherits a calss from a different shared object. I have linked that shared object when I compile my program using the -shared <path>/blah.so
My question is how exactly do I include the parent class in my program. When I tried to use
#include<parent .h>
class child : public parent {
}
the compiler complains. The class parent is in blah.so... -
How to run an executable from C++
I have a need to run an executable from C++ code. And get the output of the run for some processing in C++. How do I do that? Does C++ support system command like Perl? -
C++ memory usage
I have written a program in C++ where lot of dynamic memory allocation is done. I wanted to know how to measure the memory consumption of my program when I execute it and other metrics like the load on the CPU etc. I work on Linux env. Any pointers to detailed performance analysis would be greatly appreciated. -
Thanks! But sorry, the more I read about virtual functions, the more confused I am
Lets take this example:
class Window // Base class for C++ virtual function example
{
public:
virtual void Create() // virtual function for C++ virtual function example
{
cout <<"Base class Window"<<endl;
}
};...Leave a comment:
-
But what if I have multiple derived classes which override the function, how will 2 work?...Leave a comment:
-
Virtual Function override
I am still a beginner in C++:
Lets say i need to derive a class D from a base class B. And I have a need to override B's function called vulnerable()
There are two ways I can do it:
1. Normal override - Just re-define the function in class D
2. Virtual Function Override - Delcare it as virtual in B and then override in B
What is the advantage of one over the other? -
Accessing Map elements randomly
HI,
I have a need to randomly access a Map element.
For this I tried:
int entry ; //Randomly generated
map<int, int> blah;
map<int, int>::iterator blahI;
blahI = element + blah.begin();
But the compiler complains. I need to get an iterator to a particular element.
Thanks -
Reading unsigned int from command line
From the command line, I passed a value like this:
a.out -seed 3333333333
But when I did:
unsigned int seed;
seed = atoi(argv[2]);
cout << seed;
it just puts out the decimal equivalent of 0x7fffffff; I cannot change the internal variable to int. Any hints? -
asigning ofstream objects
I have written this function in C++:
MsgManager::Msg Manager(const string& module, ofstream& os)
{
_modulename = module;
_os = os;
}
_os is a protected member of class MsgManager. Compiler complains that the "=" operator is private. Is there a way I can do this assignment?
Thanks
No activity results to display
Show More
Leave a comment: