I am fairly new to programming and for my cs class i need to run individual programs. they don’t need to interact with anything else, so i am trying to just run the file I’m currently on but Kate just greys out the option. I really want to avoid using projects if i can because they’re just extra effort for no reason when I only need to run a single file. I did try using one, but Kate doesn’t have a new project button for some reason and i had some trouble with Cmake.

I’m aware that these are actually pretty basic things, but I can’t find anything online that actually explains how to use Kate at all. I would try using something else, but every IDE seems to have this same issue where by default it can’t run code and it has no documentation of any kind regarding actually running code, so i’ll just stick with the one that came with my distro.

also as a bonus question, why does every IDE seem to require you to configure every single option before it can run code and why do they all seem to discourage doing anything less than making an entire app?

  • moonpiedumplings@programming.dev
    link
    fedilink
    arrow-up
    18
    ·
    11 days ago

    also as a bonus question, why does every IDE seem to require you to configure every single option before it can run code

    What IDE’s have you tried?

    Kate (and vscode) aren’t really IDE’s, they’re more like extremely extensible text editors. You can make them IDE’s, but they dob’t come like that out of the box.

    On the other hands, actual IDE’s often have the inbuilt capability to install and manage the programming language related software.

    • unknown1234_5@kbin.earthOP
      link
      fedilink
      arrow-up
      3
      ·
      11 days ago

      I’ve tried Kate, vscode, some python one on windows (idk which one it was years ago), kdevelop, and I think a couple others but I forgot which ones.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      3
      arrow-down
      10
      ·
      11 days ago

      VSCode is absolutely an IDE. It is full of IDE features. The idea that it isn’t an IDE is one of those weird memes that won’t die, like people saying “an historic occasion”.

      • moonpiedumplings@programming.dev
        link
        fedilink
        arrow-up
        14
        ·
        10 days ago

        Vscode is an IDE, but only after I spent 15 minutes finding and selecting the appropriate java extensions and ensuring that my Linux system had Java installed.

        But what was a 15 minute process to me, could easily be a 2 hour struggle to someone who is setting up a development environment for the first time and “just wants autocomplete and debugging”.

        • FizzyOrange@programming.dev
          link
          fedilink
          arrow-up
          3
          arrow-down
          2
          ·
          10 days ago

          Yes in some ways it is not a beginner friendly IDE. I would also point to launch.json as being a right arse.

          Still an IDE though.

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        10 days ago

        Vscode is a text editor, sorry…“code editor”. Like you so graciously called out in a later comment, MS even clarified that it’s not an IDE. If VSCode is an IDE then so is VIM or Sublime Text or Notepad++, which of course is nonsense. IDE doesn’t just mean integrated development environment, it means it was meant to be used that way. Just because I turned my lawnmower into something that looks like an F1 race car doesn’t mean it’s an F1 race car.

        You’re clearly aware of all of the arguments why VS code isn’t an IDE so it’s pointless to have this argument, but you seem to think that just because something looks like an IDE means it is, which is just categorically false.

        • FizzyOrange@programming.dev
          link
          fedilink
          arrow-up
          2
          arrow-down
          3
          ·
          10 days ago

          MS even clarified that it’s not an IDE

          Microsoft doesn’t get to define what an IDE is. Also… I actually reread what they said and the implicitly say it is an IDE (and a “code editor” which is a fairly meaningless term):

          Visual Studio Code is a streamlined code editor with support for development operations like debugging, task running, and version control. It aims to provide just the tools a developer needs for a quick code-build-debug cycle and leaves more complex workflows to fuller featured IDEs, such as Visual Studio IDE.

          “to fuller featured IDEs”, not “to IDEs”.

          • tyler@programming.dev
            link
            fedilink
            arrow-up
            2
            arrow-down
            2
            ·
            9 days ago

            They didn’t have that originally, they added it because of people like you that are arguing that it’s an IDE when it clearly isn’t.

            Code editor makes perfect sense. It’s a text editor with code highlighting, fast search, and an understanding of different languages, oftentimes with command windows to make working with text easier. Clearly distinct from something like notepad, that only has the ability to edit text and nothing else.

            • FizzyOrange@programming.dev
              link
              fedilink
              arrow-up
              1
              arrow-down
              2
              ·
              9 days ago

              They didn’t have that originally

              They added it within 4 months of launch.

              they added it because of people like you that are arguing that it’s an IDE when it clearly isn’t.

              They added text saying it is an IDE because they didn’t want people to think it is an IDE? I think you’ve misunderstood.

              It’s a text editor with code highlighting, fast search, and an understanding of different languages…

              And integrated debugging, testing, refactoring, … Why exactly do you think it is not an IDE?

              • tyler@programming.dev
                link
                fedilink
                arrow-up
                2
                arrow-down
                1
                ·
                9 days ago

                They didn’t add text saying it’s an IDE. It clearly says it’s a code editor. They add a snippet about comparing it to actual IDEs to placate people like you, and no it wasn’t within 4 months of launch, it was years.

                lol it doesn’t have testing or debugging by default! You literally have to install extensions to do those things! It has panels where those things go, but they don’t do anything without an extension. Try running a js test from the gutter on a clean install. You literally can’t.

                • FizzyOrange@programming.dev
                  link
                  fedilink
                  arrow-up
                  2
                  arrow-down
                  2
                  ·
                  9 days ago

                  They’re saying it’s a code editor and an IDE.

                  lol it doesn’t have testing or debugging by default!

                  So the fact that they’ve designed it with an extensible architecture somehow makes it not an IDE? That doesn’t make any sense at all.

                  I guess Eclipse isn’t an IDE either then?

        • tyler@programming.dev
          link
          fedilink
          arrow-up
          4
          ·
          10 days ago

          I would say that for something to be an IDE it has to be meant to be an IDE. Clearly Microsoft didn’t intend for it to be an IDE or they would have called it that. Just because you can build something that looks and performs like an F1 race car in your garage out of an old lawnmower or ford Taurus or whatever doesn’t make it an F1 car. Unless it’s racing at Monaco in an F1 race, it ain’t an F1 car. Same thing with VS Code. It’s a code editor, like Sublime or vim.

        • RustySharp@programming.dev
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          10 days ago

          Honestly interested what makes something not an IDE but can be one? The fact that it requires plugins to turn it into an IDE?

          Does that mean Eclipse is not an IDE either, since it requires either JDT or CDT to be anywhere near useful?

            • FizzyOrange@programming.dev
              link
              fedilink
              arrow-up
              2
              arrow-down
              2
              ·
              10 days ago

              There isn’t a hard line. IDE means Integrated Development Environment. It just means that tools that - in the stone ages - were used separately are integrated into your editor. Common tools that IDEs integrate that would be separate tools with a text editor like Notepad:

              • Debuggers
              • Code intelligence (auto-complete, refactoring, go-to-definition, find-references, etc.)
              • Compile/run/debug shortcuts
              • Test running and displaying results
              • Version control

              VSCode has all of those. The fact that it implements them in a pluggable way doesn’t mean it doesn’t.

              Even though “is it an IDE” is a blurry line, VSCode is very clearly far across that line.

              The only reasons people say it isn’t are a) as a put-down - it’s not a real IDE like <my favourite alternative> - or b) because Microsoft put some nonsense about it not being an IDE on their website in order to try and explain why they make two IDEs (VSCode and VS).

          • towerful@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            10 days ago

            To me, something like visual studio is an ide.
            Out of the box it can run and debug c# programs. I can step through line by line, I can add breakpoints, I can watch variables.
            It is a great experience for developing c#.

            To get vscode to do that requires a lot of configuration.
            Sometimes all that config is done by only 1 plugin.
            The fact that there are really well made plugins for so many different languages and frameworks is vscodes power. I don’t just get a js/ts/node/deno ide, but it can be super tailored to Vue/react/svelte/quasar/nuxt/next/whatever.
            All while in a familiar editor, and without having to install another program.

            That’s what I mean by vscode not being an IDE.
            Vscode has the ability to be an IDE, but it’s 3rd parties that actually do the work to achieve this.

  • akkajdh999@programming.dev
    link
    fedilink
    arrow-up
    10
    ·
    11 days ago

    I struggled with stupid basic things like that (“how do I run a file??!”) when I was beginning to learn programming. What you can do is just open a terminal and run a command, that’s it, like python main.py. Sorry that it doesn’t answer the question.

    • dave@hal9000@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      11 days ago

      TBH, I haven’t really used Kate for coding, but I vaguely remember it having a built in a terminal as a pane, like many IDEs

  • Redkey@programming.dev
    link
    fedilink
    arrow-up
    9
    ·
    11 days ago

    I hadn’t heard of Kate before, so I can’t offer much hands-on advice. I dug around and found a “handbook” here: https://docs.kde.org/stable5/en/kate/kate/index.html

    Unfortunately it does look like you need to define a project to compile/run anything, which appears to require manually creating a .kateproject file in the directory as outlined here: https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-projects.html#project-create

    I had exactly the same problem when I moved from languages that were interpreted or combined the IDE and runtime environment into one, and starting to use languages which had their own external compiler. Unfortunately, open source project user documentation is often terrible for beginners (what I found above for Kate seems to be no exception), and IDEs often seem to be written by people who don’t really expect anyone to actually use the included build options (to be fair, most folks seem to like using their own separate build utilities, so probably this is often the case)

    If you can tell us which compiler or interpreter you’re using (e.g. gcc, clang, Python), someone can probably tell you how to compile and/or run a single-file program from the terminal with a fairly simple command.

    • unknown1234_5@kbin.earthOP
      link
      fedilink
      arrow-up
      2
      ·
      11 days ago

      I believe both clang and gcc are present on my system right now. and yeah, the Kate documentation was a little lacking. they do have little pop-ups letting you know though

  • FourPacketsOfPeanuts@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    11 days ago

    What language are you programming in?

    As far as I’m aware, in many cases, Kate just gives you access to the terminal where you can type commands to compile / run your code.

      • FourPacketsOfPeanuts@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        10 days ago

        So, I’m a bit rusty, but I believe in Kate you would hit F4 to get a terminal window and you would execute

        gcc your_file.c -o your_output_file

        Then after that’s run you’d type just “your_output_file” and hit enter

        I think on windows you’d need to make sure the output file name ends with .exe but I’m not sure about that, maybe someone else can chime in?

          • Rimu@piefed.social
            link
            fedilink
            English
            arrow-up
            1
            ·
            10 days ago

            Great!

            But now try to set a breakpoint and do some debugging and you’ll realise why most devs use real IDEs instead.

            • 3h5Hne7t1K@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              10 days ago

              Dishonest and misleading. gdb ./main.elf, break 45. Learn your tools. Optimize for learning. Select tools that generalize. Avoid lock-in.

          • Redkey@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            10 days ago

            That’s kind of the bare bones of how it works, underneath all the abstraction layers and pretty GUIs.

            Then it evolves.

            First, you start splitting your code into multiple source files, either because your programs get too big to keep scrolling up and down one huge file to cross-check things, or because you want to incorporate someone else’s code into your program, and it’s more than just one or two functions you can easily copy and paste. You can still keep compiling and linking all of this in one step, but the command gets so long that you make a shell script/batch file as a shortcut.

            After that, you might want to mix-and-match various source files to target different platforms, or to make other bulk changes, and you start going down the rabbit hole of having your shell script take arguments, rather than having a dozen different scripts. And then one day you take another look at “make” and realize that whereas before it seemed like impenetrable overengineering, it now makes complete and obvious sense to you.

            Then you discover using “make” (or a similar utility) to split compilation and linking into separate steps, which used to seem nonsensical, but now you’re dealing with codebases that take more than a couple of seconds to compile, or precompiled libraries or DLLs, and you get comfortable with the idea of just hanging on to compiled object files and (re)using them when the source for that part of the program hasn’t changed.

            And finally (maybe) you look at some of the crazy stuff in fancy IDEs and understand why it’s there; that it’s just representations of all this other stuff that you now know about and feel competent with. I say “maybe” because I’ve been programming for over 35 years, occasionally professionally but mostly as a hobbyist, and there are still things in IDEs that I either don’t understand, or don’t see the point of having them. But knowing the underlying principles makes me feel comfortable enough to ignore them.

  • razorozx@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    11 days ago

    From my experience and understanding there are generally two ways to ‘run’ a file.

    Firstly, the output is an executable itself. Assuming the permissions are valid you can just do “. /yourFile” and it’ll just execute. If the file doesn’t have the proper permissions, just do “chmod +x ./yourFile” to allow execution.

    Secondly, some executables require you to run them through a specific program. Such as Java or Python. If Java, it’d be something like “java ./yourFile.jar” If Python, it’d be something like “python ./yourFile.py”

    Sometimes it requires extra flags like “-jar” or similar. You just gotta look it up at that point. ¯_(ツ)_/¯

    In Kate, you can toggle the terminal through a shortcut for easy access.

  • MicrowavedTea@infosec.pub
    link
    fedilink
    arrow-up
    2
    ·
    11 days ago

    When learning a programming language I think it’s better to find the commands you’d use to compile/run the program and run them in the terminal the first few times so you know what’s actually happening behind the run button. Then start running things through the IDE if it’s more convenient. If you tell us the language we can help with the commands (is it C?)

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        10 days ago

        In that case I would recommend using an IDE that supports C well. On Windows Visual Studio will get you far and it is the easiest to set up with wizards to create projects etc.

        Alternatively you could use VSCode but it’s a bit harder to set up.

        1. Install VSCode
        2. Install the clangd extension from the marketplace. It’s better than the official Microsoft C++ one.
        3. Also install the CMake extension.
        4. Create a CMake project by hand (you need CMakelists.txt and main.c). In the CMake make sure you add
        set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
        

        That will give you perfect code intelligence (error squiggles etc).