Recent Posts

Pages: 1 2 [3] 4 5 6 7 8 ... 10
21
General (but related to Code::Blocks) / download for Linux
« Last post by new_time_for_new_things on June 25, 2025, 03:35:22 pm »
I notice that code::blocks doesn't have a choice for Ubuntu or many other except debian, I would love to see other popular linux distros here
22
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by Miguel Gimenez on June 25, 2025, 10:24:13 am »
Compilation on MSW now fails due to missing logmanager.h. The MSW project defines NOPCH, so sdk.h will not include logmanager.h. Also, double quotes should be used for the includes.

The solution is changing the first lines of JumpTracker.cpp to
Code
#include "sdk.h" // Code::Blocks SDK
#include "configurationpanel.h"
#include "cbstyledtextctrl.h"
#include "logmanager.h"
#include "projectmanager.h"
#include "editormanager.h"
#include "cbeditor.h"
23
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by blauzahn on June 24, 2025, 07:59:02 pm »
Thank you Tim,

I always build without precompiled headers.

The actual error from gcc is:

Quote
trunk/src/plugins/contrib/BrowseTracker/JumpTracker.cpp:1313:9: error: 'LogSlot' was not declared in this scope
 1313 |         LogSlot& logslot = pLogMgr->Slot(logIndex);
      |         ^~~~~~~

I found its definition in logmanager.h.

Quote
Should my include statement use quotes instead of <> brackets?
Yes, you are right. Its a project header, not a system header. Is is not done consistently in cb and the plugins though.

Quote
Those variables were actually initialized, but the code got smushed without white space so that cppcheck didn't recognize it.
I re-formated it to cppcheck taste.
Maybe in this case. I did not look it up before posting. Nevertheless there are numerous bad examples still in cb-code. As for BrowseSelector: The two ctors leave parts uninitialized and do not delegate. The default ctor is marked private, implemented but the comment says it is unused. I prefer code that does not pose additional puzzles. If a tool has already spotted an issue and it is not a false positive. Then why should I fire up the debugger and search for spurious errors due to UB.

I actually like having CppCheck (trunk) in addition to gcc, clang, msvc, scan-build, clangd, clang-tidy and the sanitizers.
It is a very well maintained project with constant little improvements. You can get more control over it with:
Code
--inline-suppr --suppress=missingIncludeSystem

I have a largish project, north of 500k SLOC. In that I am usually down to a dozen cppcheck warnings. Granted, the code contains some cppcheck-suppress. Please note: It also contains some NOLINTNEXTLINE. I have enabled many warnings in compiler, cppcheck and clang-tidy. Some warnings might be debatable or not apply to some cases in a codebase. I prefer to not kill warnings globally but document exceptions on a per case base right at the spot in code. Needs judgement but that is a good thing. Recently, cppcheck changed the semantics of paths for #include. At the moment I get numerous missingInclude warnings. Did not yet investigate on that. Slightly annoying, hopefully just temporarily.

Thanks for adding the missing guard against nullptr. I would prefer code where this is not needed in the first place. With old code, you can not avoid it completely. But in newer code I'd at least try to minimize is.

If you are under Linux, I recommend to try scan-build( see https://clang.llvm.org/docs/analyzer/user-docs/CommandLineUsage.html#scan-build).
It reports several bugs in cb.
24
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by stahta01 on June 24, 2025, 06:56:41 pm »
Hi Pecan,

thank you for the effort.

With the last patch (svn13671 BrowseTracker Move ... ) I get a compile error when building on Linux with make. An include is missing:
Code
#include <logmanager.h>
I don't understand this, logmanager.h is an sdk header, not a BrowseTracker header. It's included in trunk\src\include\Makefile.am Should my include statement use quotes instead of <> brackets?

I build without PCH and just got the same error with the git repo that is updated every 24 hours so it is likely 12 to 36 hours old at most.

So, test with out using PCH and you will likely get the issue.

Tim S.
25
Using Code::Blocks / Re: UI : how to close all sub program at once ?
« Last post by Miguel Gimenez on June 23, 2025, 04:40:53 pm »
Look at Edit -> Folding and Settings -> Editor -> Folding.

You can add shortcuts using Settings -> Editor -> Keyboard shortcuts
26
Using Code::Blocks / UI : how to close all sub program at once ?
« Last post by Mandrake8790 on June 23, 2025, 03:58:50 pm »
Hi,

I want to close at once all the sub programs.
Does it exist a shortcut or an item menu to do that ?

User case (see picture) :
i open several sub programs, so there are a lot of minus signs inside squares.
i want to close them all at once => the result : there are only plus signs

Thanks
27
General (but related to Code::Blocks) / Re: I just start learning C++
« Last post by stahta01 on June 23, 2025, 01:07:10 pm »
Website rules basically Code::Blocks questions are okay; but, programming how to is off topic (OT).

https://forums.codeblocks.org/index.php/topic,9996.0.html
28
General (but related to Code::Blocks) / I just start learning C++
« Last post by Hortudy on June 23, 2025, 09:42:20 am »
Hello,

I'm a newcomer just learning C++ and Code::block seems to be a good soft to learn.

My mane goal is too develop audio plugins, this is why I choose to lear C++.
29
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by Pecan on June 22, 2025, 10:00:25 pm »
Hi Pecan,

thank you for the effort.

With the last patch (svn13671 BrowseTracker Move ... ) I get a compile error when building on Linux with make. An include is missing:
Code
#include <logmanager.h>
I don't understand this, logmanager.h is an sdk header, not a BrowseTracker header. It's included in trunk\src\include\Makefile.am Should my include statement use quotes instead of <> brackets?

Quote
When scrolling very briefly through the diff I noticed a function with a suspiciously empty if statement. It looks like unintentional semantics:

Code
void JumpTracker::OnLeftUp(wxMouseEvent& event) {
    if (m_leftDown && (not m_isDragging)) {
        // Pure click (no drag) occurred
    }
    m_leftDown = m_isDragging = false;
    event.Skip();
}
I had removed some old code. I added a comment to make it clearer. But cppcheck won't like it anyway.

Rant: I have never gotten cppcheck to work reliably. It spews out vast amounts of error or warning messages even when the compiler or clangd does not.

Quote
When I run CppCheck over the BrowseTracker cb-project, I get several warnings. E.g.:
Quote
BrowseTrackerLayout.cpp:173:41: warning: Either the condition 'cursor' is redundant or there is possible null pointer dereference: cursor. [nullPointerRedundantCheck]
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^
BrowseTrackerLayout.cpp:155:17: note: Assuming that condition 'cursor' is not redundant
            if (cursor)
                ^
BrowseTrackerLayout.cpp:173:41: note: Null pointer dereference
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^

or
Quote
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_pBrowseTracker' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_menuID' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownCode' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownMods' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^

Besides other warnings.

Since the topic-starter observed a crash, these should be fixed.

Have a nice day.

Those variables were actually initialized, but the code got smushed without white space so that cppcheck didn't recognize it.
I re-formated it to cppcheck taste.

I've changed the "cursor" statement to guard against use of a nullptr. Thanks.

Thanks for looking at this.
30
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by blauzahn on June 22, 2025, 10:29:25 am »
Hi Pecan,

thank you for the effort.

With the last patch (svn13671 BrowseTracker Move ... ) I get a compile error when building on Linux with make. An include is missing:
Code
#include <logmanager.h>

When scrolling very briefly through the diff I noticed a function with a suspiciously empty if statement. It looks like unintentional semantics:

Code
void JumpTracker::OnLeftUp(wxMouseEvent& event) {
    if (m_leftDown && (not m_isDragging)) {
        // Pure click (no drag) occurred
    }
    m_leftDown = m_isDragging = false;
    event.Skip();
}

When I run CppCheck over the BrowseTracker cb-project, I get several warnings. E.g.:
Quote
BrowseTrackerLayout.cpp:173:41: warning: Either the condition 'cursor' is redundant or there is possible null pointer dereference: cursor. [nullPointerRedundantCheck]
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^
BrowseTrackerLayout.cpp:155:17: note: Assuming that condition 'cursor' is not redundant
            if (cursor)
                ^
BrowseTrackerLayout.cpp:173:41: note: Null pointer dereference
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^

or
Quote
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_pBrowseTracker' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_menuID' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownCode' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownMods' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^

Besides other warnings.

Since the topic-starter observed a crash, these should be fixed.

Have a nice day.
Pages: 1 2 [3] 4 5 6 7 8 ... 10