Why people hate Wine:
- It discourages the development of Linux native apps
- It gives people a reason to want Win32 apps
- It opens up security risks
Why people hate Wine:
As promised, the next part of my coding in Linux guide. Last time i covered my choice of IDE, and now i'm gonna use it. My intent was to work with Open GL, and that will come in time, but after some research it seems that my blog is more popular amongst KDE users. So, this is the plan. A basic QT app, with Open GL included somewhere :)
In Codeblocks there are many project options. Making sure that you already have qt4-devel packages installed, create a new QT4 project. It'll probably ask for an Environment variable path. Define the Base to /usr and that should be it. Then Codeblocks will hopefully give you a main.cpp containing the basic QT setup. Running this app should give a simple window with a Quit button.QT reference/tutorials can be found here, its a great thing to keep open if u'r coding an app and your main aim isn't the UI. After all thats why i prefer QT, it lets me focus on my app and not have to deal with really disgusting UI code ( note GTK and Win32 ). In QT there are 2 constructs which you probably won't have seen outside of QT code:
To make use of the SIGNAL/SLOT features of QT, make your object inherit from QObject ( directly or indirectly ) and add Q_OBJECT right at the top of the class declaration ( just after the opening brace ). Then you have access to the slots and signals macros which can be used in an equivalent way to private and public. You also have access to the emit keyword, which allows your app to send a signal to whoever might be listening.
So, time to actually do something.In Codeblocks, create a new file, selecting a C++ header. Once you've given it a name ( and path ), you'll see that Codeblocks auto generates a header guard word! Note that although usage of #pragma once is pretty standard, it isn't actually in the C++ specification, so it doesn't have to work. Click All on this dialog to add you're new header to all build targets ( another thing i love about Codeblocks, build target config is really simple ). Create this, and create a cpp in a similar way. I made a basic QT app:
myApp.h
#ifndef MYAPP_H_INCLUDED #define MYAPP_H_INCLUDED #include; class myApp : public QObject { Q_OBJECT public: myApp( QObject* parent ); ~myApp(); public slots: void updateColor( int newValue ); signals: void colorChanged( int newValue ); private: unsigned int m_red; unsigned int m_green; unsigned int m_blue; }; #endif // MYAPP_H_INCLUDED
myApp.cpp
#include "myApp.h"Now this will not compile ( sadly ). Due to the way QT works, you need to perform a meta-object compilation, using the moc tool. If you look in your project's Build Options, under Pre/Post build steps, we can add custom commands. I added a script to my projects root folder ( called runMoc.sh ), and added the following to the custom commands:myApp::myApp( QObject* parent )
:
QObject( parent ) { printf("Creating myApp\n"); } myApp::~myApp() { printf("Killing myApp\n"); } void myApp::updateColor( int newValue ) { }
./runMoc.shThe contents of my script is:
#!/bin/sh grep -l Q_OBJECT *.h > files_to_moc cat files_to_moc | while read line do echo "Moc'ing file $line"; ext=h output=${line%h} moc $line -o "moc_$output""cpp" doneAlthough the details don't really matter, the script basically finds all .h files with Q_OBJECT in them and calls moc on them. Then the moc call generates a new cpp called moc_
The first of the android phones looms close, and what is there to show for it. We have an operating system with a lot of potential, open to developers ( sadly in Java ), and with ability to replace almost any application. And what does the HTC-Dream, er sorry, TMobile G1 have to say for itself?
The advantage is the freedom of platform. As a software developer ( who dislikes Java ) i really appreciate the ability to write daemons, and apps that could replace my contacts/sms apps. I keep mentioning the Java issue. My reason for this is as that i am currently an iPhone developer, and altho i dislike the proprietary platform, the performance is amazing. The reason is not the hardware, since they're about the same. Java is the killer. iPhone development happens primarily in C++ or Objective-C (yuck). Both of those are on hardware, low resource languages. When i saw the android demo of a bouncing ball at 40fps ( which he was boasting about ), i laughed. With a full 3D scene, some 3D physics ( including sphere/trimesh collisions ), and about 3000 triangles, we're getting 30fps on the iPhone. 40fps for a 2D sprite is disgusting. I'd have been ashamed, to even admit i was only getting 40fps.
This all said, i'm still debating whether or not to get the G1, or if i should wait for Samsung, LG or Motorola to release their android models, and get an iPhone now? The G1 is only coming to my ( Netherlands ) shores in Q1 2009 ( along with Germany, Czech Repl, and Austria ), so it's a while to wait. Luckily US consumers get it this month ( 22 Oct ) and it's slated for launch in November in UK.
It's a really tough choice, because the iPhone is an amazing piece of hardware. Again i am very against proprietary formats, but the iPhone is really what they claim, and even though its closed, its the best phone around by a long shot.
Whatever happens, i'll have some interesting news on both iPhone and Android Games soon ;)
As a developer it can be _really_ frustrating looking for solutions to problems. Say you're working with a new library, and you know other people use it, but you have no clue how. This often applies when you're using C++ and get some hardcore C library, that would only make sense to people who have been coding in C in a basement somewhere for the last 10 years.
A common complaint that i have, and it seems i'm not alone, is that you can search for days and mostly get one of 3 things:
Then i discovered stack overflow! It's a site that allows users to log in ( with any openID account if you have - blogger account is part of it ), and post a programming related question. Anyone can view this, whether you have an account or not. Now i hear what a lot of people will say, its all good to have a forum, but people will have to read it. Well, there are at least 2 people who work for the site that will look over the questions they can answer. But still, no 2 people can know everything right?
My trial of this site shows me that there is more than enough traffic to generate answers to questions. I've posted 3 questions so far, each one generating at least 3 answers within the first week, and getting over 50 user views. All of my questions have had pretty satisfactory answers, 2 of them telling me exactly ( including some code posts ), what i needed to know. The last one, my question was illdirected and badly phrased, and i still got a good answer to my question, even though it wasn't what i was looking for.
So if you're a developer, i really advise having a look, its a great site, and more knowledge never hurt anyone ( except a few organisations ).
It seems that google docs has an options to post from google docs to a given blog, including blogger!!! Since i really hate the blogger interface, and can never get a blog written through it, this is an official test to see if it works. Well done google for realising how much the blogger interface sucks
In the next few weeks i will be posting a series of blogs about development of applications on linux, 3D graphics, physics, networking and all of my discoveries as a developer. This should include some warnings, tips, tricks, and anything useful to developers who primarily use linux. This first post will focus on tools!
As a developer who has worked commercially in a Windows development environment, i have to admit, Visual Studio is good. Sadly ( although it would benefit Microsoft greatly ), VS is Windows specific. So what to do if you want to develop on a Linux OS? There are many environments out there, and in my opinion most of them suck. I want to be able to develop for anything, i like my graphics and physics based applications, but i don't want to be forced into writing a GUI. Sometimes i want to write a GUI, and something like GTK# really doesnt do it for me ( i much prefer QT ). I want code completion, my typing sucks. Although i've been coding for years, i'm still a bad typist. Makefiles are a pain, but if i want them, they must be accessible. At the same time i want to be able to just quickly create a project without having to worry about setting up makefiles and stuff like that. And Visual Studio solution support wouldn't hurt. And if anyone wants their IDE to be more like XCode, they've been working on a Mac too long and need a break.
My tests taught me this:
Being my choice, Codeblocks is what i will refer to for the rest of this series. You can get it from www.codeblocks.org and installation is pretty simple. Using openSUSE 11.0 linux, all i did was searched the Webpin software repo's and installed the latest version i could find.
If anyone has any other suggestions for IDE's, please do let me know, i'm always looking for new software to play with!
Next Week i will hopefully cover some basics of 3D graphics in openGL.
www.flickr.com
|