how to write a c program that runs on a mobile phone? - c

i wanna write a C program that runs on a mobile phone. Just for learning purpose. i think it's possible. but i dont know where to start with and the libraries that are available for it.
i have also planned to write a game that runs on a mobile phone.
help me to do it. thanks in advance.

I do not know a mobile platform where its SDK are reccomending using pure C anymore. Last that I knew of was the old Palm platform.
But you can write C/C++ with QT as GUI library for Maemo, MeeGo and possibly other Nokia devices. QT are object oriented, so its not procedural as you want.
I know of 1 platform where pure C is possible. That's the windows mobile version <6.5 using win32 api. But this is not a thing I personally recommend doing since C#.NET makes it easier to develop applications for that platform. I also think that pure C combined with XML/CSS using the WebOS PDK is possible but I might be wrong here.
If you have a wish to write for mobile devices using your knowledge in C then i would rather recommend to use languages like C++ and Objective-C where you also can write C and use C libraries.
A list of mobile devices and the programming languages used to develop applications for them:
Symbian - C/C++
iOS - Objective-C
Android - Java
Windows Mobile - C/C++/.NET
WebOS - C/C++

How about MoSync. It's OS-independent SDK. MoSync applications are written in the C and C++ programming languages.

Programming is almost same. Try downloading one of the SDKs and review the documents for any of the platforms you want.
1) iPhone
2) Android
3) Bada (This is Samsung's latest platform)
SDK comes with cross compilers , simulators and IDE to assist you.
Will add more to this.

Java-to-C compiler may work in J2ME case. You can try Clue: http://cluecc.sourceforge.net/

Related

Best Mobile Programming IDE for Sony Ericsson (Symbian-UIQ)

What is the best IDE for developing a C++ application targeting Symbian UIQ-based phones like p990 and p1?
So far I have come across Carbide C++ which seems good but I am not sure if it supports UIQ (maybe it only supports S60 platform) and if it's the best option.
Yes Carbide C++ is the right answer. UIQ SDK availability is another story, however. After the bankruptcy of UIQ the rights to UIQ were locked down, and have not been contributed to Symbian Foundation.
As far as I know there is no "legitimate" way to get hold of the SDK. On the other hand, there is no rightsholder who will chase you down if you do...
Carbide C++ should support UIQ, but I think you need to download a UIQ SDK separately.
Not sure where you can get that today as UIQ has closed there website.
Sony Ericsson used to have SDK extensions for some of their devices available from developer.sonyericsson.com
Sony Ericsson has a UIQ archive here.
It mentions Borland C++ Builder and I seem to remember that the UIQ3 SDK also supported Visual Studio.
Do you absolutely need to be programming in C++? It should still be pretty easy to write JavaME applications for the P990 and P1.

C + GUI + Mac OS

i know c and I want to develop applications with GUI for Mac OS. Where do I start?
Learn Objective-C.
Then pick up Cocoa (and all of the Frameworks that go with it)
Buy Apple computer
Install XCode from supplied DVD
Run Software Update from system menu
Run XCode
Select Help menu, select "Developer Documentation"
Click on any of the many things that say things like "Quick Start" or "Getting Started with XCode".
Read
Program
GoTo 7.
Downloading xcode would be your first step. It's the main development environment for mac development and it's free. Then you'd want to get a book on Cocoa w/ Objective-C or Carbon w/ C. Apple is pushing Cocoa more.
The Simple DirectMedia Layer (SDL) library is yet another option. It is a cross-platform development library that can be used to write GUI-based applications for Mac OS in C.
While there is Carbon, it's a framework that's not first-class going forward. If you want to make sure that you can access all of the features of Mac OS X, you'll want to learn Objective-C and use Cocoa.
I believe all Macs nowadays come with a complete set of development tools. They're not pre-loaded on the Mac, but are in the CD-ROM or DVD-ROM package. Alternately, you can go to Apple's site and poke around until you find the development section, and download Xcode. (It'll be the same thing, but possibly a newer version.)
Mac OSX uses a language called Objective-C, which is C extended with OO abilities that are more like Smalltalk than the more usual Simula type (in C++, say). While you don't actually have to use it much, it is how you'll be writing interface code.
Further, it uses the Cocoa framework. There was a framework called Carbon, which was a cleanup and redesign of the pre-Mac OSX Macintosh system facilities, but it's being left behind.
You can find free information on either if you look, or you can buy books on them. Books are probably a better resource to learn from.
You can also try with QT and C++. Try here:
http://qt.nokia.com/products/platform/qt-for-mac

How to make window application in ANSI C?

Until now I've been only writing console applications but I need to write a simple window application for a school assignment.
Could somebody point me to a good tutorial how to create windows and other ordinary windows elements such as buttons, 2d graphs etc in ANSI C? is there some good library I should use?
I tried googling but there are no tutorial websites devoted to C.
If you can, I would also appreciate some example code.
Thank you.
By the way, I use Dec C++.
GTK is a good library to use, but may provide non-native looks under Windows. It looks great under GNU/Linux, especially using GNOME.
It is implemented in just C (Using the GObject Type System, part of the GLib library), so it will work great for your needs. There is also a RAD tool called Glade.
There's nothing in the ANSI C standard about windows. If you want to make a windowed application, you'll have to use platform-specific libraries (e.g. Win32, Cocoa, or X11), or some sort of cross-platform library that encapsulates that (e.g. SDL, wxWidgets, or many more).
Common places to start are Charles Petzold's Programming Windows and theForger's Win32 API Programming Tutorial.
However in most cases C is no longer the preferred language for Windows development. Object oriented technology is far better suited to GUI development, and with the introduction of MFC, C++ became the preferred language, and later with .Net, C# and C++/CLI.
The Win32 API can be hard work, much of MFC is little better than a Win32 API wrapper, the .Net framework however was designed from the ground up, and is less encumbered by the legacy of the Win32 API monster, and working with it tends to result in far greater productivity.
Either way, Dev-C++ is not a great tool for GUI development.
http://support.microsoft.com/kb/829488 which also talks how to create
Windows application: Creates a simple
Microsoft Windows-based application.
The application files include a
ProjectName.cpp file that contains a
_tWinMain function. You can use this type of application to perform
graphical user interface (GUI) based
programming.
As for tutorials... use MSDN. Win32 API is C. You don't need "Win32 ANSI C tutorial" - you need Win32 tutorial (for example http://www.winprog.org/tutorial/start.html, http://www.functionx.com/win32/Lesson01.htm) - unless, of course, you don't know ANSI C but then you just look for ANSI C tutorial. These subjects are independent.
There are lots of good libraries—too many for there to be an obvious choice without starting a religious war. I recommend that for your first library you learn something that will work on Windows, Linux, or OSX. Here are two good choices, not necessarily the best, but widely used and personal favorites:
Tcl/Tk. You write most of your application in the Tcl scripting language, but you can easily integrate your own ANSI C code into Tcl, which was designed from the beginning with such integration in mind. The Tk toolkit is very easy to learn, and you can write many simple GUIs in pure Tcl when you are getting started. Interactive, easy, and very well supported.
If you want to write everything in ANSI C, I don't know of any really simple choices, but I've been fairly happy with wxwidgets. All these tools have a pretty steep learning curve, however.
There are not many plain C GUI libraries as the strengths of the language lie elsewhere. Perhaps you should think about using a language with C bindings so you can still do the number crunching in C, but use something less painful for GUI development?
If you really want to stick to C, you can either use the OS' native API or the only current cross-platform C GUI lib I'm aware of: GTK+. If you don't really need a GUI but just graphical output, I'd go with SDL.
I suggest you download Microsoft Visual Studio 2008 Express Edition and use C#.Net.
As has been said, I suggest you use Winforms and switch to a .Net environment. It's 2009, and I think there are more suitable solutions to GUI's :P
Edit: Nvm, didn't see it was a school assignment.
However, here is a C++ guide on the Win32 API: http://www.relisoft.com/win32/index.htm

Which mobile os is easy to program with?

I want to learn some mobile stuff, and programming interesting things myself
on mobile phones, what is popular and easy-to-use mobile operating system?
This is extremely subjective.
Java developers will be more comfortable on the Blackberry, Android or J2ME platforms, while Windows developers will likely be more comfortable with Windows Mobile.
Personally, I find programming for the iPhone very enjoyable and easy. I found Objective-C easy to learn. The tools are also well made and the frameworks intuitive IMO.
I've also come to personally dislike coding for the Blackberry. Simple applications require too much code and designing interfaces is an enormous pain.
But as I said, this is very subjective. I'd recommend going through the Getting Started examples of the each of the platforms you have in mind and deciding after having some exposure to each.
Windows Mobile has fairly easy development with .NET Compact Framework.
WebOS (Palm Pre, etc.) has an easy to use HTML/Javascript like environment. Check out their 'Hello World!' example to see what I mean.
Android isn't bad if you're familiar with Java. (Same goes for Blackberry)
iPhone might be the most complex in my opinion because of the use of Objective-C (it's also probably the most robust). Check out their Programming Guide Introduction to get an idea about what I mean. You might want to check out MonoTouch which allows iPhone development in .NET.
.Net Compact Framework is pretty easy to work with. And works great on Windows Mobile devices.
Without to know which platform you are used to program on, it is not possible to give a correct answer. If you are used to program on Windows, and you are already using .NET framework, then it would be better for you to learn how to program on Windows Mobile; if you are already a Mac developer, then it is easier for you to learn how to create a program for iPhone OS (which is also used on the iPod); if you are a Java programmer, then you should be more comfortable with Android.
IMO, you start to program on a mobile platform that can be programmed using the same framework for the desktop applications because that would allow you to not learn two different frameworks

Strict C Win GUI programming

Good day folks, I'm in a need of a bit of guidance.
Basically, I'm a webdev who knows some C from the past, but I've only developed somewhat simple console apps for *nix.
Shortly, I want to develop a simple Win program with a GUI and not get my hands into any of the following technologies:
.NET C#
Java
C++ (especially this one)
Because I have nor the time nor the need for it currently.
1). Can I use wxWidgets without resorting to cpp (if not, what other native looking and lightweight widget toolkit would you suggest?)
2). Can I use OpenCV with strict C? (no templates, inline functions, etc)
3). Should I look for other options for a compiler besides MinGW? Is Intel one worth investigating? (AFAIK, it has a restrictive license).
4). What IDE of the following would you suggest for windows / c programming
Dev-C++
Eclipse with appropriate plugins (can't remember the exact one)
Any text editor + *.bat for compiling??
Thanks!
If you're interested in learning C-based Windows programming directly, and not using other intermediate tools:
There's a really good reference book by Charles Petzold called Programming Windows. It's definitely the way to get started. Absolutely everything is crystal clear, and you never need C++.
The Windows API, as a whole, is built for C programmers. All the fancy stuff like an actual application window is passed back as "HANDLE"s, which are more-or-less just pointers into the OS's object table. You as a programmer never have to deal with objects, just their HANDLEs.
Also, this particular book does a good job describing the Windows event-loop. If you're unfamiliar with it, it is described in generous detail.
Good luck!
For C Windows GUI programming the easiest thing is VC++ (any version since 6.0) and The Charles Petzold Programming Windows book.
The free Express version of the Microsoft compiler should work fine - I'm not sure if you'd have to download the Platform SDK or if it comes with one.
You can write Windows GUI programs in straight C. Download the Windows SDK and look at the "GENERIC" sample (I assume it's still in there). This is pretty much the minimal code required for a Win32 app, and it's in plain-ol' C.
Edit: Hmmm, it doesn't appear to be installed on this laptop. You can find it online here.
It might be worth reconsidering C#.NET. You could easily learn C# in a couple days, and be developing slick apps very quickly. Straight C-based windows libraries, particularly Win32, are BRUTAL in comparison. You'd spend a week just to write a simple app that would take minutes in C#.
The only C-based toolkit I can think of is the Windows port of GTK+. I have no experience using it in the Windows environment though. It is very mature on the Linux side though, and may be good enough if your needs are simple.
Learning the Win32 API is hard! But like others have stated, Petzold's book is the way to go if you insist on going down that path.
My opinion is that developing a Windows GUI using only C and the Win32 API would be harder to learn than picking up just enough C++ to utilize one of the C++-based frameworks. You could still do the majority of your work in plain C.
As for free IDEs, I would go with Visual Studio 2008 Express Edition.
You don't need anything.
Just use C and Win32 api , like real programmers, not kids..
See the VS Win32 wizard
Regarding wxWidgets, you can use https://sourceforge.net/projects/wxc
I never actually heavily used it, so I'm not aware of its maturity.
Mingw and Microsoft Visual C++ are my favorite compilers. Remember you can always use strict C and compile it using a C++ compiler, since valid C is almost always valid C++.
For windows, I've used Dev-C++ in the past, but nowadays Microsoft Visual C++ seems a better solution.
If you're going for text editor+bat, check out Notepad++.
EDIT: Just to clarify, using Microsoft Visual C++ does NOT mean learning C++. You can use C in it perfectly because - I repeat - valid C is often valid C++. Don't want C++? No problem. Just stay away from the C++-only features and you're still safe in a C++ compiler.
EDIT: Roger Lipscombe has noted in the comments that a pure C compiler is available in Microsoft's Visual C, using the /TC switch.

Resources