how to configure sonarlint in VScode for C language? - visual-studio-code

I'm practising clean code and I installed sonarlint as a static testing tool to help me write clean code. after installing the editor rises this notification
SonarLint is unable to analyze C and C++ file(s) because there is no configured compilation
database.
after some searching, I found that I should add a file with a name
compile_commands.json.
this file should be exported automatically by cmake after adding this option
CMAKE_EXPORT_COMPILE_COMMANDS
where can I add this option in VScode.
this link is where the vscode redirected me to creat the required .json file

I am assuming that you are using CMake for your build. If that is the case then add the following line to the CMakeLists.txt
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Then build the project and the database will be created for you.

Related

How do I convert/ build .juce file to vst3 plugin

The following repository contains a .juce file along with c++ source file. The operating system I am currently working on is Ubuntu. I want to be able to build this file into a .vst3 file so that it can be added as a plugin in any DAW which has that capability. When I open the .juce file in Projucer, it only lists Visual Studio 2017 as an exporter option, with no option to add exporters (usually for Linux, the options are Code::Blocks and Makefile). How do I build the source files here to create a .vst3 plugin file?
In the projucer application, if you click on the plus icon in the bottom left, you will get a menu with which you can specify which exporter configuration you want to add to the project.
After adding the linux makefile as an exporter configuration, you should save the projucer file which will generate the makefiles.
Then you can use "make" via terminal to compile the plugin in the specified formats.
Please make sure to enable the VST3 option in the settings page.

Gtkmm in Eclipse makefile project: "could not be resolved"

I am trying to migrate a custom C++ project which uses Gtkmm3.0 to Eclipse (Oxygen) on Ubuntu 16.04. The project has its own Makefile and builds fine from the terminal within Eclipse. What I have not been able to do so far is tell the indexer about Gtkmm, and I get lots of these (which is very annoying):
When I hover over the little red bugs, it says:
Type 'Cairo::RefPtr<Cairo::Context>' could not be resolved.
I have done a lot of Googling on this and found nothing so far because all answers seem to assume the project's build tools are managed by Eclipse (See this or this, for example). In my case I have a makefile project instead of an executable project and hence some options are not available to me. For example, the first links speaks about configuring the builder:
We have to add all this directories. On Eclipse select the Project->Properties menu option. Select C/C++ Build->Settings property page and GNU C++ Compiler->Directories from the Tool Settings tab. Now we have to add all directories. In my case (Makefile project) only two tabs are available there: Binary Parsers and Error Parsers.
How can I tell the Eclipse indexer I am using Gtkmm3.0?
Found the solution that works for me:
Open a terminal and enter:
pkg-config --cflags gtkmm-3.0
You will see a list of includes directories (starting with -I). These are the directories you want to add in Eclipse so that it can locate the Gtkmm symbols in the editor.
In Eclipse, go to:
Project -> Properties -> C++ General -> Paths and Symbols
In the Includes tab, select GNU C++. You need to add here add the include directories found in step 1. There is no automated way to do this, yo must enter them one by one.
One trick that can save you some time is to edit manually the Eclipse project setting XML file and add the include directories directly in the XML file. By the end, you should have something that looks like this:
That did it for me, hope this helps!

How to use SASS with Netbeans 8.0.1

I'm trying to use SASS in Netbeans 8.0.1. I have Ruby and SASS set up correctly based upon the feedback from ruby -v.
I have a web application set up with css and scss folders under Project\Web Pages\resources.
My input and output are set to /scss and /css respectively and I have checked 'Compile Sass File on Save'. I have created a styles.scss file and added some SASS/CSS.
When I save the styles.scss file, is it supposed to generate a styles.css? Nothing happens when I save or compile the project.
Has anyone run into any similar problems or have suggestions on how to debug this problem?
Thanks in advance!
Installing SASS on Windows10, Ruby2.2.3, Netbeans8
Download SASS for Windows - RubyInstaller.org
Install Ruby like:
Search windows for CMD (Command Prompt) and start it.
Access Ruby's bin folder using cd \Ruby\bin (Hit Enter)
Install sass using the command gem install sass (Hit Enter to install)
Wait for the installation to finish
In Netbeans open
Options → Tools → Miscellaneous (HTML/JS in v8.1+) → CSS Preprocessors tab
Enter the path to the installed sass.bat C:\Ruby\bin\sass.bat than click Install Sass.
Confirm your changes with Apply / OK
Use an existing one or Create a New Project (HTML5, PHP, whatever...).
After the project is created open the Projects window.
Right-Click your project and choose > Properties.
From the Project Properties popup select CSS Preprocessors.
Select the Compile SASS Files on Save.
(If you want the compiler to automatically minimize your .css result file, use --style compressed under the Compiler Options)
You can see from the image above that the compiler uses two default Input(watchable)/Output(compiled destionation) folders paths.
Create the scss folder (an optionally the css folder) in your project as well.
You're done!
As soon you create a new .scss file or you save it Netbeans will automatically compile the file to .css in the /css folder.
Yes, when you save the file, the css should be created/updated. I think you have wrong mapping for the input/output directories. The paths need to be relative to site root/web root. I don't know for sure what your project is (HTML5 or PHP or Java Web or other?), but if you have Java Web project, then the paths need to be
resources/scss -> resources/css
Salam guys, the below image form my (Command Prompt with Ruby) says that:
"Ruby Sass has reached end-of-life and should no longer be used"
For modern SASS and Netbeans we can just use https://github.com/sass/dart-sass/releases/tag/1.56.1 and install it in our PATH.
The release has the sass.bat file we need (as Roko C. Buljan pointed in his tutorial for Ruby).
There's not need to install Ruby and any other environment.
I applied this on Netbeans 15

Eclipse doesn't recognize lua files after installing the lua plugin

I downloaded Eclipse Classic off of the Eclipse website then the Lua Eclipse IDE plugin. I followed the install instructions but Eclipse doesn't seem to recognize or be able to understand lua files. Can someone help?
Sounds like your file types aren't associated. Click on Window/Preferences and select General/Editors/File Associations.
Add more information
Which installation guide did you follow? (Lua Eclipse Installation?)
Which OS (version)?
Which java version? (Which implementation)
Which eclipse version?
I love these kind of questions because they provide an opportunity to do a test I postponed until now...
So I downloaded the plugin package, and followed the instructions: closed Eclipse, put two jar files in the plugin folder, put the open-ldb.exe elsewhere, restarted Eclipse.
I created a generic project, added a generic file linked to an existing Lua file. When I opened the file, it was automatically identified as such, with a moon icon and correct syntax highlighting.
Using Eclipse 3.5.1 on Windows XP, BTW.
Now, I have an issue, the debugger won't start for me, I get a
Unable to connect to PDA VM
Connection refused: connect
error, not sure why (path to exe file is correct, I have another error when it is wrong).
But at least I have the Lua files recognized without problem.
I think you might want to check that in Preferences > General > Editors > File Associations, *.lua is defined and associated to the Lua editor.
Instead of opening a File you have to do the following:
Open a new LUA project.
Then import using 'File System' all files (resources and LUA files) into the project.
Now you can see and edit the LUA files. Don't know why it doesn't work by simply opening a LUA file directly.

how to add a tool to eclipse-cdt to automatically generate a header file during make

I have a tool that converts an data file into a C header file for inclusion into my project.
Now I would like to have this tool run automatically during make whenever the data file changes.
Where can I tell Eclipse CDT which tool to run and what data file the header depends on?
The article "Extending the Eclipse CDT Managed Build System" can give a concrete example of the managed build system (MBS) of CDT.
The MBS can be extended by modifying/adding a "tool" to the tool-chain (An ordered set of tools used to transform the project resources into the final output (build artifacts) of the project)
You should be able to add your tool, and set it up to be active for each file modification.
Open the properties of your project. There is an entry "Builders" where you can add other executables to the build.