views:

62

answers:

2

Hi all,

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 :-)

A: 

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.

Shiroko
Thanks for the response Shiroko.I thought about that but then why is it that it seems to work just fine so long as I don't use the Image * variable from the header file?
Hovito
Are you stepping with the debugger or does it suddenly stop running in this code? If this is the latter you probably tried dereferencing a `NULL` or some garbage which will cause the debugger to pause, in the middle of unknown code.
Shiroko
Shiroko, I'm stepping through with the debugger.To me _problematicDecoder and workingDecoder are exactly the same, except for where they are defined. So I'm really confused as to why workingDecoder->Construct() is fine and _problematicDecoder->Construct() isn't.
Hovito
A: 

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 :)

Hovito