Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Getting rid of non-existant errors, question about recognition of C++ standard things.

Hello all,

I've been working on a project and the blot of red eclipse CDT is showing me is driving me insane / winning.

I'd really like help getting rid of two kinds of "errors"

Firstly:
Things it should recognise.

CTD hates this line:

Node* newNode = new Node(::std::forward<T>(what));

it believes the part I have underlined to be an error. I have included <utility> of course.

I've refreshed, cleaned, restarted, checked for updates (nothing by the way) several times.

Ptr(::std::nullptr_t pointer) {

This one need not be included - it should be present always - it is the type of nullptr.

That's all the c++11 stuff (I've used) that it thinks are errors.

So still in the first section, it doesn't like it when I use a much older C++ feature, implict construction.

messages.append(newMessage);

In this line I expect C++ to do something along the lines of: messages.append(PtrWrapper(newMessage)); as PtrWrapper<whatever newMessage is> is the type messages is a list of.

There are a lot of those.

Otherwise it is really good, weirdly it correctly interprets listeners[k] != nullptr - in this case the nullptr is used to construct a Ptr that can then be compared to listeners[k] (you can see the constructor as the 2nd error in this list) and identifies the overloaded !=.

Secondly
I'm using wxWidgets and it seems to have only found parts of it. Some stuff is recognised correctly other things it is convinced are errors. - inconsistently

class GameFrame: public wxFrame {
public:
    GameFrame(Core*);

    DECLARE_EVENT_TABLE()
private:
    Del<Core> game;
};


Here it has correctly identified DECLARE_EVENT_TABLE as a macro

However in the .cpp file that goes with it:

GameFrame::GameFrame(Core* game):
    wxFrame(nullptr,wxID_ANY,wxString(_("Game!"))),
    game(game)
    {
    wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    SetSizer(sizer);
    sizer->Add(new LogView(this,game->getLog()),1,wxEXPAND);

    game->getLog().append(_("Installed the log viewer"));
}

BEGIN_EVENT_TABLE(GameFrame,wxFrame)

END_EVENT_TABLE()

It is convinced the macros are errors, it also doesn't recognise the _ macro (surrounding "Game!")

It also can't resolve <wx/wx.h> - so it claims anyway.

Yet weirdly:

MyApp::MyApp() { }
bool MyApp::OnInit() {
    Core* core = new Core();
    wxFrame* frame = new GameFrame(core);
    core->getLog().append(_("Hello?"));
    frame->Show();
    return true;
}

It correctly recognises the _ macro here.


In this code, it doesn't recognise the _ (and thus not the InsertColumn) and such

LogView::LogView(wxWindow* parent,Utils::Log& log):
    wxPanel(parent,wxID_ANY) {
    listenToLog(log);

    listCtrl = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
    wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    SetSizer(sizer);

    sizer->Add(listCtrl,1,wxEXPAND);

    listCtrl->InsertColumn(0,_("Time"));
    listCtrl->InsertColumn(1,_("Type"));
    listCtrl->InsertColumn(2,_("Message"));
}

But it correctly recognises listCtrl->SetItem(itemId,2,message.getMessage()); (getMessage returns a const wxString&) - it also doesn't recognise wxLC_REPORT

All of this compiles and runs.

The only thing that has changed (maybe) is that my Make output is a bit more verbose

For example:

    COMPILE        build/Utils/Log.o (Due to changes: [huge list of files omitted])
g++ -Wextra -Wall --std=c++11 -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -g -gdwarf-2 -c src/Utils/Log.cpp -o build/Utils/Log.o


In previous projects the first line (COMPILE) was omitted. I checked Eclipse's settings just in case and this SHOULD NOT trigger the rule it uses to match compiler invokations

It is also shown the linking command just with "[tab]LINK (some info)" above it - Eclipse should also ignore. There are no new lines or anything!

What is wrong?

I hate to complain a lot of stuff works really really well but I don't know how else I can guide CDT into finding stuff.

Alec

BTW the project is an IDE for creating blobs that can be fed to an engine, incase you are curious.



Back to the top