How can a Linux source package be opened as a project in an IDE? - linux

I am makeing a small mod to SMPlayer; the Linux version...
The make, sudo make install from the command line works, but I would like to have the project in an IDE.
I want to use CodeBlocks IDE, only because I've used it before, but if some other IDE is required, I can use that instead... (I use Codeblocks because it is simple, and that suits my current ability to handle an IDE)..
Is there some way to use SMPlayer's Makefile, or some such thing?

This depends on the IDE and has little to nothing to do with Linux.
Does your program come with something like cmake or another setup tool? That normally makes it much easier. For example in KDevelop you can import straight from CMakeLists.txt and Makefiles.
If all else fails it might be quite easy to do something like this (not knowing your specific IDE):
Add new Project
Set build directory and other necessary settings (like compiler and compiler flags)
Add the already existing files to it.
Press "Compile"-button.
This is obviously depending on the project structure, setup and size.

Code::Blocks has builtin support for Makefile projects. See the FAQ.
Also you could just use vim or emacs ;)

Related

How to use two Qt5 versions on KDE Plasma to avoid conflict?

I am using Opensuse Leap 42.3, with KDE Plasma 5.8.7 which uses Qt 5.6.2.
I would like to use the latest Qt version (5.10 as of asking this question) for development, and I've installed it in /usr/local/Qt5.10/.
I added Qt5.10 library path (/usr/local/Qt5.10/5.10.0/gcc_64/lib/) to my /etc/ld.so.conf but it caused a conflict with system's Qt version, which as a result anything using Qt libs (Dolphin, Kate, etc) won't work, and if logged out, cannot login, complaining about qdbus.
I tried to create symlinks in /usr/lib64 like this:
for f in /usr/local/Qt5.10/5.10.0/gcc_64/lib/libQt5*.so.5.10; do
ln -s $f /usr/lib;
done
But this too, made the same problem. I have also added a LD_LIBRARY_PATH entry in ~/.profile but with the same problem.
I can do export LD_LIBRARY_PATH="/usr/local/Qt5.10/5.10.0/gcc_64/lib/" in a terminal and run my Qt5.10 application, but this is not convenient.
What is the correct way of doing this?
It may not be convenient, but setting the path up as you launch seems to be the only way to avoid the issues you mention.
I also use KDE, and am playing with Qt 5.10 visualisation stuff on a system using Qt 5.9 and have experienced the hell of mashed library dependencies you mention.
Qt Creator seems to take care of that and in other environments (eg: KDevelop) you can add it to the path in the run/debug launch settings. And although not portable, you could also add it to the path for your desktop file...
The qtchooser utility might be useful although I admit I don't really understand how it's supposed to work.
Yes, I realise this is a low quality answer but I am interested in seeing a better solution too.

Qt Creator: add Qt module to project

So when I create a new Qt project inside Qt Creator I'm only asked for some simple details like location of the project, build targets, the main window class name (along with header, source and form file) and at the enda choice to add it to version control.
After I create the project I'm only given the qt core and gui modules. My question is how do I add other modules (such as network or opengl). I've looked and looked, yet I cannot find anything on how to add other Qt modules easily. I know I can edit the .pro file, but unfortunately I don't know all the modules in Qt, nevermind the name I'm supposed to put there. Adding external libraries is easy, but how come there's no (obvious) option to add Qt libraries?
Help would be much appreciated ^_^ Thanks!
Oh yeah... I'm running Arch Linux if that's any help.
Edit your .pro file. It should has one line like this:
QT += core gui
Append the desired modules in this line. To get the module's names, just remove the "Qt" part in this list. (e.g. QtSql turns "sql")
I can't find that either.
It seems that in older versions of the "New project" wizard you used to be able to specify which modules you wanted to use, but even then you were not able to alter your choice later. And this seems gone now, so your only choice is to manually edit the .pro file.
As others have pointed out, you simply #include the module you want in the source and add the name of the module in the .pro file to the QT variable.
However the actual documentation you need which no one else has mentioned is the qmake Project Files page. qmake is very powerful and it's well worth getting familiar with how it works and I think that's why they don't provide a complete GUI for it, as it can handle some very complex scenarios.
You have to read the documentation to add the modules.
Frankly speaking, I never really felt like that there needs to be a GUI for that.

Emacs/VIM vs. Compiler

Since Emacs and VIM are just text editors, does that mean I have to copy paste the code into an IDE so it can be compiled?
Well you edit your files in emacs or vim. Then you save them and then you invoke the target language compiler.
Typically, C projects would use Makefiles that are meant to track down the files needed to be compiled into a program, and their dependencies. Then you typically type make in the command line and make reads the Makefile you authored and takes care of invoking the compiler on the files etc...
For Java, people often use Ant or Maven to build their software.
...I know that my answer is vague, the list of languages and build tools is long, you should narrow down your question.
Very often, under Linux, when I don't need a massive IDE, I'm using Pida. It brings me a list view of the different Vim buffers, a convenient treeview of the filesystem and a shell: see screenshot.
See:
GNU Make
CMake
Autotools
Ant
Maven
[insert your favorite build tool here]
Text editors just edit files.
Compilers just compile files.
IDE's just bring files and the compiler together in a convenient way.
So... No, you don't need to copy/paste the code into an IDE, however you do have to make sure your compiler (IDE in your case) knows where to find the file you want to compile.
You don't need an IDE to compile a program. You just need a compiler. Emacs/Vim are text editors that allow you to write your program. You then call the compiler and it will do the compilation.
Also, Emacs and Vim are scriptable and have routines that allow you to call a compiler directly on the file you're editing.
In vim, you type :make. In emacs, you type a M-x compile-frobnicate style command which I'm sure someone will provide.
Apart from what already has been said, take a few tutorials to learn how to code/compile with vim and Emacs:
Intro to C/C++ Programming with vim
Using Emacs for programming
In VIM (with no extensions installed) something like
! /path/to/make (C/C++ world)
or
! /path/to/ant build (Java world)
It depends on your compiler, platform, and program. Most, like gcc, can be called from the command line (or from within either of those editors) although you may have to first write a makefile for the linker. Other compilers are integrated into IDEs (or are difficult to control externally), although even these won't require copy/pasting. Simply save your program and open it from within the IDE.
So far: IDE = a poor editor + compiler + debugger + other_unnecessary_stuffs
Go get a compiler and a debugger and you do not need an IDE anymore
Many IDEs can detect if the source file is changed by an external program, and prompt you to reload. I know this is the case with MS Visual Studio and CodeWarrior.
This is useful if your project is already managed by the IDE and you don't want to move it to something like Make, for example if you're on a team who mostly use the IDE, but you want to use a different editor. Simply edit and save the file in vim or emacs, switch back to your editor and hit Compile.
No, you don't need an IDE to compile code that you write in emacs.
I use emacs very extensively for building .NET code in C#.
The .NET runtime includes compilers.
I downloaded the .NET SDK, which includes other tools, like nmake, msbuild, XML tools, debuggers and so on.
I grabbed csharp-mode.el, which teaches emacs how to highlight and indent C# modules.
C-x C-e , for me, runs the command compile. I type in msbuild there, and emacs runs the build, using the .NET SDK tools.
I do something similar with C code, and with Java code, and with Javascript.
The same idea will work with other languages as well.
For Visual Studio integration, I highly recommend ViEmu.
It basically turns the editor in VS into Vim. I use it every day at work, and it is very stable. I can't imagine working without it!
(source: viemu.com)

which GUI based C++ IDE is commonly used for gnome applications

which GUI based C++ IDE is commonly used for developing gnome applications?
I am asking specifically for the gnome-system-monitor because I would like to fiddle around with it. And I would like to do it with a nice GUI based C++ IDE.
I thought that Anjuta is the default IDE for gnome applications. But when I fetch the sources there are no files which are obviously project files.
EDIT: Here is what I did so far
# get the build dependencies for the gnome-system-monitor
sudo aptitude build-dep gnome-system-monitor
# get the sources for the gnome-system-monitor
mkdir example
cd example
apt-get source gnome-system-monitor
# build the gnome-system-monitor
cd gnome-system-monitor-2.28.0
sh configure
make
But nothing inside gnome-system-monitor-2.28.0 looks like a "project file".
I believe Glade is used, or at least was used at the time.
BTW, I'm not sure Gnome is C++. There are C++ wrappers, like gtkmm and glibmm, but I believe that core Gnome is written in C.
Simply "create project from existing sources" in Anjuta. Anjuta's "project files" do not contain a lot of information, instead the Makefile.am and configure.ac files are used.
I have no idea what the gnome-system-monitor developers use, but I've read that a lot of Gnome developers use emacs, which apparently also doesn't require "project files".

compiling actionscript in linux

I'm working on a website that requires a flash mp3 player. I have absolutely no idea the procedures from messing with flash/actionscript/flex etc., however I need to edit the flash very slightly (I need to add two lines of code). There are a multitude of tutorials out there for setting up a flash (or flex or whatever) development environment but, as my needs are so simple, I'd like to go a little more light-weight than that (also, many seem outdated). I guess what I'm saying is I'm looking for a simple way to recompile some existing actionscript (command line is a plus!). Does anyone have a trick up their sleeve to accomplish this?
Download the free/opensource Flex 3 SDK. This includes an ActionScript3 compiler. Run the compiler like this:
mxmlc MyAs3File.as
There's MTASC for ActionScript 2.
You can compile it online here: http://wonderfl.kayac.com/. No mess that way.
I also wanted to say that swftools has exactly what you need. There is a swfc compiler which will compile as2 files. I would really recommend updating the source though. AS3 is much faster than AS2 and there are a lot of tools out there for example mxmlc and fcsh included in the open source Flex sdk. If you are looking for a full blown IDE there is a linux version of Flash Builder that was released as an open source port ... there are a couple other ones out there as well.
General Linux
On linux you can get the source from swftools.org.
Debian / Ubuntu
On debian / ubuntu you can run
apt-get install swftools
Mac OS X
Not exactly 'linux' but on mac OS X if you have homebrew installed you can do:
brew install swftools
Great, but how do I compile the code?
One this is installed you should have a new utility that you can use to do:
as3compile MyAs3File.as
Gotchas
Please note this is not a 1:1 replacement for Adobe's compiler - there are some things that it does not support ( see documentation, FAQ, changelog at swftools.org ) but it worked well for compiling my simple actionscript.

Resources