0

I'm trying to crosscompile some porject in eclipse, but I'm getting a error which is driven me crazy. It has to be with the inclusions and libraries headers, in the picture it can be seen the project tree. PICTURE

The issue is that I cannot understand why I the path I'm using is wrong for the compilation, any advice?

Thanks in advance,

This is the TestUtils.cpp where the inclusion gives error

#include "TestUtils.h"

#include <ibrdtn-0.8.0/utils/Utils.h> //sucks

CPPUNIT_TEST_SUITE_REGISTRATION (TestUtils);

void TestUtils::setUp()
{
}

void TestUtils::tearDown()
{
}

void TestUtils::tokenizeTest()
{
    using namespace dtn::utils;
    CPPUNIT_ASSERT(Utils::tokenize(":", "").empty());
    CPPUNIT_ASSERT(Utils::tokenize(":", "::").empty());
    CPPUNIT_ASSERT_EQUAL((int)Utils::tokenize(":", ":a:test::", 2).size(), 2);
    CPPUNIT_ASSERT_EQUAL((int)Utils::tokenize(":", ":a:test::b::", 2).size(), 3);
    //TODO how should the added string in the last item look like? "b::" or ":b::" or "::b::"
    CPPUNIT_ASSERT(Utils::tokenize(":", ":a:test::b::", 2)[2] == "b::");
    CPPUNIT_ASSERT_EQUAL((int)Utils::tokenize(":", ": :", 1).size(), 1);
    CPPUNIT_ASSERT_EQUAL((int)Utils::tokenize(":", ":    :t e s t: ").size(), 3);
}

The error is this /tests/utils/TestUtils.cpp:10:38: warning: ibrdtn-0.8.0/utils/Utils.h: No such file or directory

And the Utils.h which does not seem to exist is this

#ifndef UTILS_H_
#define UTILS_H_


#include "ibrdtn/data/Bundle.h"
#include "ibrdtn/data/CustodySignalBlock.h"
#include "ibrdtn/data/StatusReportBlock.h"
#include "ibrdtn/data/PayloadBlock.h"

namespace dtn
{
    namespace utils
    {
        class Utils
        {
        public:
            static void rtrim(std::string &str);
            static void ltrim(std::string &str);
            static void trim(std::string &str);

            static vector<string> tokenize(std::string token, std::string data, size_t max = std::string::npos);
            static double distance(double lat1, double lon1, double lat2, double lon2);

            static void encapsule(dtn::data::Bundle &capsule, const std::list<dtn::data::Bundle> &bundles);
            static void decapsule(const dtn::data::Bundle &capsule, std::list<dtn::data::Bundle> &bundles);

        private:
            static void encapsule(ibrcommon::BLOB::Reference &ref, const std::list<dtn::data::Bundle> &bundles);
            static double toRad(double value);
            static const double pi;
        };
    }
}

#endif /*UTILS_H_*/
ndarkness
  • 1,011
  • 2
  • 16
  • 36

1 Answers1

0
  • First problem, since it is not part of your includes being referenced by Eclipse, then it should be surrounded by quotations "" and not <>.

  • Second, your inclusion path is incorrect. There is a ibrtn subfolder for which you are not taking account. So, instead of having the main parent folder, the inclusion path should be #include "ibrdtn/utils/Utils.h"

Fix those two items and you should be in business.

Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41
  • You have `ibrdtn-0.8.0/utils/Utils.h` I see from your picture it should be `ibrdtn-0.8.0/ibrdtn/utils/Utils.h` Unless there is something you are not showing. You can even see that directory in the Utils.h where you have the correct paths (including the `ibrdtn` dir) – Benjamin Trent Jan 18 '13 at 16:08
  • I've already done it but I have still the same issue, `code error: .../ibrdtn-0.8.0/tests/utils/TestUtils.cpp:10:45: error: ibrdtn-0.8.0/ibrdtn/utils/Utils.h: No such file or directory` – ndarkness Jan 18 '13 at 16:11
  • It seems that both the `TestUtils.cpp` and the `Utils.h` are in the `ibrdtn-0.8` dir, correct? If so, I misread the trees. I will modify my answer as the path should probably be `ibrdtn/utils/Utils.h`. This is in quotations, of course. – Benjamin Trent Jan 18 '13 at 16:22
  • Yes youŕe right they both are in `code ibrdtn-0.8 `, I have made the changes but without success – ndarkness Jan 18 '13 at 16:28
  • I've kept trying but with any output, do you have another suggestion? – ndarkness Jan 20 '13 at 18:47
  • it's always the same, that it cannot find the file Utils.h... I think it has to be something with eclipse path, but I don't understand why that inclusion retreives errors and the other don't – ndarkness Feb 01 '13 at 15:03
  • Well, first, I would add your headers to be inclusion paths when you compile. If eclipse cannot find them, you may want to try something similar to [this](http://stackoverflow.com/questions/10803685/eclipse-cdt-symbol-cout-could-not-be-resolved). I have had issues like this in the past and if the path is absolutely correct and eclipse cannot find it, the inclusion paths need to be refreshed. There are many ways to do this and the aforementioned link is just one way. – Benjamin Trent Feb 01 '13 at 17:20