Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Anbang24 on March 01, 2024, 03:14:17 am

Title: suggest new script plugin to create project for single source file
Post by: Anbang24 on March 01, 2024, 03:14:17 am
As we know, Code::Blocks recommend developing programs with project instead of single source file. In single-file developing with Code::Blocks, one can compile and run the executable, but debugging buttons and menu items are disabled. From time to time, there are users asking why the debugging buttons and menu items are disabled, the standard answer is to suggest them to create a project.

Many users (especially programming beginners) prefer single-file developing, we shouldn't ignore their request. Here I propose a suggestion to satisfy both Code::Blocks developers and those users: provide a script plugin (maybe named "Single file project") to create project for single source file.

For example, a programming beginner wrote a single source file named "test.cpp" and saved in directory "D:\myprogs", he should click the menu item of "Single file project", then a project named "test.cbp" containing "test.cpp" will be created and saved in the same directory, and the project is opened automatically, so he will be working with project now, and debugging buttons and menu items will be enabled now.

I am unfamiliar with script or plugin developing, so I am unable to write such a script plugin. I hope someone would consider about it.
Title: Re: suggest new script plugin to create project for single source file
Post by: stahta01 on March 01, 2024, 08:51:00 pm
Sounds like a waste of time to me.

The problem is the users do not wish to use projects! Creating a script to make a project would still require them to use projects!

Tim S.
Title: Re: suggest new script plugin to create project for single source file
Post by: Anbang24 on March 06, 2024, 04:30:32 am
My suggestion is suit for the following situation: a programming beginner is working on a single file, he find something wrong and want to do debugging; then he can click the script (a project created), and can start debugging now.
Title: Re: suggest new script plugin to create project for single source file
Post by: ollydbg on March 06, 2024, 04:47:41 am
My suggestion is suit for the following situation: a programming beginner is working on a single file, he find something wrong and want to do debugging; then he can click the script (a project created), and can start debugging now.

There are many options (compile option, link option, search option, build target option) which are needed for a "project file".

For my point of view, a user(maybe a beginner) should first create a project, and then add a source file later.

When you are editing a standalone cpp file, there is no "project information". When you click on a menu, you still need to add a "project file", such as a console hello world cbp file. Maybe, you cbp file can have this cpp file as the only source file?

Title: Re: suggest new script plugin to create project for single source file
Post by: blauzahn on March 06, 2024, 07:38:34 am
I am against this idea. When a new user starts cb, the first thing on the "Start here" page after the cb version is "Create a new project". If you select the "Console application" you have a single main.cpp and a project file. If even that looks too much for your taste, you can always use any text editor and the console to call your compiler. Granted, on windows that makes no fun unlike on linux. Apart from that, nowadays many beginner have never used a console before. As @ollydbg stated, an ide has to store the options somewhere. Feel free to compare that with the megabytes of filed one gets flooded with in other ides like VS. An additional plugin seems not worth the trouble.

Users sometimes complain about software being way too complicated. Despite that, in the same sentence, they want yet another feature.