Author Topic: suggest new script plugin to create project for single source file  (Read 2472 times)

Offline Anbang24

  • Multiple posting newcomer
  • *
  • Posts: 14
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7607
    • My Best Post
Re: suggest new script plugin to create project for single source file
« Reply #1 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Anbang24

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: suggest new script plugin to create project for single source file
« Reply #2 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: suggest new script plugin to create project for single source file
« Reply #3 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?

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blauzahn

  • Almost regular
  • **
  • Posts: 173
Re: suggest new script plugin to create project for single source file
« Reply #4 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.