简体   繁体   中英

Problem debugging C++ with an Eclipse based IDE

This is a weird question in that I'm not sure where to start looking.

First of all, I haven't done any C++ programming for the last 10 years so it could be me thats forgotten a few things. Secondly, the IDE I'm using is Eclipse based (which I've never used) and customized for Samsung bada based mobile development (it kicks off an emulator for debugging purposes)

I'm posting my code samples as images because the StackOverflow WYSIWYG editor seems to have a problem parsing C++.

[EDIT] Due to complaints I've edited my question to remove the images. Hope that helps :)

I have the following header file...

#include <FApp.h>
#include <FBase.h>
#include <FGraphics.h>
#include <FSystem.h>
#include <FMedia.h>

using namespace Osp::Media;
using namespace Osp::Graphics;

class NineAcross :
    public Osp::App::Application,
    public Osp::System::IScreenEventListener
{
    public:

    static Osp::App::Application* CreateInstance(void);

    public:
    NineAcross();
    ~NineAcross();

    public:     
    bool OnAppInitializing(Osp::App::AppRegistry& appRegistry);

    private:
    Image *_problematicDecoder;
};

...and the following cpp file...

#include "NineAcross.h"

using namespace Osp::App;
using namespace Osp::Base;
using namespace Osp::System;
using namespace Osp::Graphics;
using namespace Osp::Media;

NineAcross::NineAcross()
{
}

NineAcross::~NineAcross()
{
}

Application*  NineAcross::CreateInstance(void)
{
    // Create the instance through the constructor.
    return new NineAcross();
}

bool NineAcross::OnAppInitializing(AppRegistry& appRegistry)
{

    Image *workingDecoder;      
    workingDecoder->Construct();

       _problematicDecoder->Construct();

    return true;
}

Now, in my cpp file, if I comment out the line that reads _problematicDecoder->Construct(); ...I'm able to set a breakpoint and happily step over the call to Constuct() on workingDecoder . However, as soon as I uncomment the line that reads _problematicDecoder->Construct(); ... I end up with the IDE telling me...

"No source available for "Osp::Media::Image::Construct()"

In other words, why can I NOT debug this code when I reference Image *image from a header file?

Any ideas?

Thanks :-)

This usually means you're stepping through some code which you do not posses its source. I assume here that Osp::Media::Image is a class supplied by Samsung or similar for which you do not have the cpp file. So this means the debugger can't show you the current code line while you're at a function of Osp::Media::Image .

Alternatively, there's a good chance you do have all of the source code for this class, but Eclipse doesn't know where it is. In this case you can add the correct directories under the Debug Configurations window.

Ok, problem solved.

The idea is to first new up an instance of Image like so...

_decoder = new Osp::Media::Image();

And then do _decoder->Construct().

Funny enough, this seems blatantly obvious to me now coming from the C# world, though why the code I posted for workingDecoder works is still somewhat mysterious to me. The fact the sample projects pre-loaded with the bada IDE don't seem to make a call to new() leads me to believe that perhaps those samples are outdated our out of synch.

Either that or I really AM wildly out of the C++ loop.

Anyway thanks so much for the effort guys.

Appreciated :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM