I have an ARM project that I'm building with make. I'm creating the list of object files to link based on the names of all of the .c and .cpp files in my source directory. However, I would like to exclude objects from being linked if they are never used. Will the linker exclude these objects from the .elf file automatically even if I inc...
Hi,
I'm unfamiliar to working in c++ under linux so I have some issues, one of them is that after I write a class and try to instantiate an object of that class I get to following error : "undefined reference to Constructor_of_that_class" . This happens for every class that I write , and it happens no matter where I try to do the in...
That's pretty much it. I need to allocate memory and pass it to a function that takes a void *. I'd like to use a shared_ptr but I don't know how to do it.
...
I am interested in an array of software ideas and use more than one language, is there somewhere that concisely lists software development conferences year by year? I'd like to know what options are out there for this year and searching by ideology/language isn't practical in my opinion to get an overall.
Some ideologies/languages that...
Hi All,
I have code that uses a pre-compiled header. (previously done by someone else)
In it, they are including several .h files.
If I have classes that use common .h files that are not currently in the existing pre-compiled header, would tossing them in there be of any real benefit? Maybe compilation speed, but I was thinking it wou...
#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int i, s, g;
vector<int> a;
cin >> s;
for(i=1;i<=s;i++)
{
g = s;
if(g<10) a.push_back(g);
else {
vector<int> temp;
while(g > 0)
{
int k = g % 10;
g =...
Hello,
I have the following FORTRAN code which I need to convert to C or C++. I already tried using f2c, but it didn't work out. It has something to do with conversion from Lambert Conformal wind vector to a True-North oriented vector.
Is anyone experienced in FORTRAN who could possibly help?
PARAMETER ( ROTCON_P = 0.422618 )...
I've got a string value of the form 10123X123456 where 10 is the year, 123 is the day number within the year, and the rest is unique system-generated stuff. Under certain circumstances, I need to add 400 to the day number, so that the number above, for example, would become 10523X123456.
My first idea was to substring those three charac...
Hi,
I've stuck myself in a c++ project under linux ,for which I get an undefined reference when I try to create an object of a class that I just wrote.I believe this is an linker error caused by the fact that somewhere , somehow I should tell the linker to take into account the new class. I looked at the project properties and at the r...
It's been a long time since I've done C++ and I'm running into some trouble with classes referencing each other.
Right now I have something like:
a.h
class a
{
public:
a();
bool skeletonfunc(b temp);
};
b.h
class b
{
public:
b();
bool skeletonfunc(a temp);
};
Since each one needs a reference to the other, I've...
These questions are a kind of game, and I did not find the solution for them.
It is possible to write ::: in C++ without using quotes or anything like this and the compiler will accept it (macros are prohibited too).
And the same is true for C# too, but in C#, you have to write ???.
I think C++ will use the :: scope operator and C# wil...
I'm trying to work with a Python module that was generated by SWIG. There's a C++ class defined that works like this (simplified):
namespace Foo
{
class Thing
{
public:
Thing();
~Thing();
bool DoSomething(uint32_t x, uint32_t y, uint32_t z, uint32_t *buffer);
};
};
When I try to call it from P...
how can I retrieve pagerank of any page indexed by google ?
Has google any api or page for this ??
...
Hi All,
I am porting a very large code base and I am having more difficulty with old code.
For example, this causes a compiler error:
inline CP_M_ReferenceCounted *
FrAssignRef(CP_M_ReferenceCounted * & to, CP_M_ReferenceCounted * from)
{
if (from) from->AddReference();
if (to) to->RemoveReference();
to = from;
return ...
In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace.
class Car
{
public:
enum Color
{
RED,
BLUE,
WHITE
};
void SetColor( Car::Color color )
{
_color = color;
}
Car::Color Get...
How can I define a array of boost matrices as a member variable?
None of the following worked.
boost::numeric::ublas::matrix<double> arrayM(1, 3)[arraySize];
boost::numeric::ublas::matrix<double>(1, 3) arrayM[arraySize];
boost::numeric::ublas::matrix<double> arrayM[arraySize](1, 3);
Thanks,
Ravi.
...
Let's say I have two maps:
typedef int Id;
std::map<Id, std::string> idToStringMap;
std::map<Id, double> idToDoubleMap;
And let's say I would like to do a set operation on the keys of the two maps. Is there an easier way to do this than to create a custom "inserter" iterator? such that I could do something like:
std::set<Id> res...
Least Recently Used (LRU) Cache is to discard the least recently used items first
How do you design and implement such a cache class? The design requirements are as follows:
1) find the item as fast as we can
2) Once a cache misses and a cache is full, we need to replace the least recently used item as fast as possible.
How to analyze a...
found this typo recently
if (name.find('/' != string::npos))
I was amazed that it even compiles at -Wall -Werror (didnt try with -pedantic)
so coffee quiz - does it eval to true or false
edit : answer - true
string::npos -> inta (usually -1)
'/' -> intb
inta != intb -> bool true
bool true-> int = 1 (probably) -> char 0x01
name.fin...
I think there should be a tool to do so ? is anyone here aware of any ?
I saw other posts related to this but found none for C++, I am aware that I can do that with JAVA and C#.
...