I have a problem with Eclipse Indigo complaining that class methods cannot be resolved, but compile in any case and work correctly (AFAIK). This is a very simple program. Here is Population.cpp:
#include <stdlib.h> #include <iostream> #include <time.h> #include "Population.h" Population::Population() { // TODO Auto-generated constructor stub } Population::~Population() { // TODO Auto-generated destructor stub } void Population::initializePop(int numBits, int N) { srand((unsigned)time(0)); for(int i=0; i<N; i++) { x[i] = (char*) calloc(numBits, sizeof(char)); for(int j=0; j<numBits; j++) { if( rand() < 0.5 ) x[i][j] = 0; else x[i][j] = 1; } } } char** Population::getX() { return x; } void Population::printStuff() { std::cout << "Whatever"; }
Now I am creating this code and everything is fine. In another project in Eclipse, I call this code as follows:
#include <typeinfo> #include <string.h> #include <iostream> #include "cute.h" #include "ide_listener.h" #include "cute_runner.h" #include "Population.cpp" void testPopulationGeneration() { Population* p = new Population; int N = 10; int bits = 4; char** pop; ASSERTM("Population variable improperly initialized", dynamic_cast<Population*>(p)); std::cout << p->printStuff(); std::cout << "Ok..."; p->initializePop(bits, N); pop = p->getX(); ASSERTM("Pop not correct size.", sizeof(pop) == 10); }
As you can see, I am also launching the CUTE plugin for TDD in C ++. He does not complain when I declare p as a type of Population, and the first statement passes. I'm a little new to C ++, but I definitely added a project from which Population.cpp was sent to the include path for the test project.
This is not a huge deal, as it does not affect anything obvious to me, but it is still very annoying. I do not see a situation where he should do it.
Thanks for any help!
F_c
source share