![](/img/trans.png)
[英]Debugging C++ in an Eclipse-based IDE - is there something like “step over loop/cycle”?
[英]Problem debugging C++ with an Eclipse based IDE
這是一個奇怪的問題,因為我不確定從哪里開始尋找。
首先,過去十年來我沒有進行過任何C ++編程,因此可能是我忘記了一些東西。 其次,我使用的IDE是基於Eclipse的(我從未使用過),並且針對基於Samsung bada的移動開發進行了自定義(它啟動了用於調試目的的仿真器)
我將代碼示例發布為圖像,因為StackOverflow WYSIWYG編輯器似乎在解析C ++時遇到問題。
[編輯]由於投訴,我已編輯問題以刪除圖像。 希望有幫助:)
我有以下頭文件...
#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;
};
...以及以下cpp文件...
#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;
}
現在,在我的cpp文件中,如果我注釋掉讀取_problematicDecoder-> Construct();的行; ...我可以設置一個斷點,並愉快地跳過對workingDecoder的Constuct ()的調用。 但是,只要取消注釋該行, 便會讀取_problematicDecoder-> Construct();。 ...最后,IDE告訴我...
“沒有可用於“ Osp :: Media :: Image :: Construct()”的源”
換句話說,當我從頭文件中引用Image * image時,為什么不能調試此代碼?
有任何想法嗎?
謝謝 :-)
這通常意味着您正在逐步瀏覽一些沒有源代碼的代碼。 我在這里假設Osp::Media::Image
是Samsung或類似公司提供的類,您沒有該類的cpp文件。 因此,這意味着當您使用Osp::Media::Image
函數時,調試器無法向您顯示當前代碼行。
另外,您很有可能擁有該類的所有源代碼,但是Eclipse不知道它在哪里。 在這種情況下,您可以在“調試配置”窗口下添加正確的目錄。
好,問題解決了。
這個想法是首先像這樣新建一個Image實例。
_decoder =新的Osp :: Media :: Image();
然后執行_decoder-> Construct()。
有趣的是,對於我來說,這似乎是顯而易見的,現在我來自C#世界,盡管我為workingDecoder發布的代碼為什么對我來說仍然有些神秘。 預裝了bada IDE的示例項目似乎並未調用new(),這一事實使我相信這些示例可能已經過時了。
要么,要么我真的很瘋狂地脫離了C ++循環。
無論如何,非常感謝你們的努力。
感激:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.