Skip to content


Using Qt Creator as your IDE for Rust

Qt Creator is a great IDE for C++, and it recently included support for the Language Server Protocol. This means that we can add the ability to write in other languages to the IDE, like Rust for example. In this post I will show you how to do exactly that.

First, make sure you have Rust installed and that everything works as you would expect. For example, you should be able to create a new Rust project with this command:

cargo new ide_rust

We can open these Rust files into Qt Creator in the following way. Go to File->New File or Project, then select Import Project, and Import Existing Project, as shown in the following image:

Now simply select the folder that was created by cargo and set any Project name you want:

Under file selection, simply click on the folder to add all the files:

Finally choose if you want to use git or other version control software and click on Finish:

You should now be able to navigate and open the files of your project in the IDE:

We are now going to configure Qt Creator to work with Rust. Go to Tools->Options->Kits and go to the Debuggers tab. Click on Add, specify a name like Rust-GDB for example, and under Path specify where rust-gdb is located in your machine:

Now go to the Kits tab, click on Add. Select a name, like Rust for example, and on Debugger select Rust-GDB.

Now we are going to update the syntax highlighter. Click on Text Editor and go to Generic Highlighter. Then, click on Download Definitions, and then Reload Definitions. This should update them to the latest version.

Now click on OK to close the Options window and go to Projects (on the left side), and under both, the build and clean steps, simply remove them by clicking on the small x mark on their right side:

It should look like this:

Now at the build and clean steps, click on Add Build Step, select Custom Process Step and write cargo build and cargo clean respectively at the appropriate fields:

Now click on the Run tab on the left and select your executable:

You can now go back to the Edit tab and edit the file. You can press CTRL-B to build or CTRL-R to run your application, as well as auto-complete with CTRL-Space:

You can also press F5 to start debugging the application:

And that’s it, you can now write, build, run, and debug applications using Rust in Qt Creator.

Posted in Programming.

Tagged with , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.