How to develop GTK+ programs on windows? - c

There isn't a windows binary release, so when it says that they are cross-OS, they mean you can write source to compile on windows, but you have to develop in linux/osx? But then what if you want to make calls to win32api within the app, and want to test as you go along?

They mean you can develop under Windows and you do not have to compile the libraries for yourself.
Binaries for GTK+ and its dependencies can be found here.
Cross OS means that the same API is available across all supported platforms.
Direct calls to the win32 API can be made normally in a GTK+ application.

Related

Using different GCC to build Linux vs Linux Apps

This question may seem weird for some gurus out there, but I'm a little perplexed.
Basically what I want to do is to evaluate different tool chain for developing applications on embedded Linux. Say I have my Linux built using Yocto Project, which cross-compiles GCC from scratch can provide it as a cross toolchain for apps developers.
But if I want to try out different toolchains fro this point, say Sourcery CodeBench or a toolchain generated using BuildRoot, is it possible to build a applications using these toolchains and still run them on the Yocto-generated Linux? I'd imagine this is doable is built statically. But if we then want to link dynamically, it's simply a matter of copying over libc?
Thanks for the help. Sorry if question is ambiguous.

X11 installation in ECLIPSE

I have been trying to install X11 in Eclipse for C. I have to design visualization applications in C using X11. I am used to Eclipse for java. I need your help for the detailed steps to get X11 directory and getting Xlib.h, xatom.h,xos.h,xutil.h file access through eclipse.
I have been trying very hard but not able to find suitable answer. I like Eclipse because its easy to debug and I have windows operating system.
Please suggest me how can I proceed further?
X11 is a windowing system widely used on Linux and Unix systems. You have 2 options:
Go native and install you favorite Linux distro, either as a VM or on actual hardware, then install eclipse on that.
Try using Cygwin. Cygwin allows you to run *nix apps on Windows and X server is one of the apps supported.You can find more info on http://x.cygwin.com/
If you are trying to do C/C++ development then you need to install the Eclipse CDT package. This allows you to create a C/C++ project inside of eclipse in which you can then write your X11 program.
If you are doing Java development, then you don't use X11 or even Windows.h directly, instead you use the Java Swing framework to do your graphical UIs. When run on an X11 based system (unix) it will use X11 underneath to render the display, while on a carbon based system (OSX) it will use Carbon and on a Windows system it will use windows api.
However, you also mention you are using the "windows operating system" and if by that you mean Microsoft Windows, then there is no (practical) way to do X11 development on windows. You really need to stop and think about what you are trying to achieve and perhaps post a different question about how you can accomplish that.

Can native C programs be used in LibGDX?

I have a program in C which i would like to call and use it in LibGDX so that i can use it both for android and desktop. So can you suggest me methods to call a C file into LibGDX?
To be clear, I believe you have an app written in Java that uses Libgdx currently, and you would like to extend that app by including a C library and making calls out to the C library from the Java application.
Libgdx does not provide any special support for third-party libraries, native or Java. You will have to use the backend platform's APIs to call out to native code (JNI, NDK, etc).
You should be able to add your library to the Android and Desktop backend projects, and access it via a Platform Interface. It is probably not possible to use the GWT-backend (unless you have a C to Javascript compiler). For iOS you would need to build your library for iOS, and then figure out how to link it into the Xamarin (or robovm) build process for your app. While I'm going to assume this is possible, I suspect neither is easy to accomplish.

Cross Compilation for C applications using Eclipse

I'm developing a java application which uses native code with JNI, so I developped a C shared library using Eclipse with the CDT plugin on Linux Redhat. Everything works fine since I can launch my java application and call the native methods without any problem. But my problem is, I need to compile my code on every platform (Linux, Windows, x86/x64). It's not a problem to get the libXXX.so file but I also need a .dll to run on Windows, except I can't just compile my code on it, I need a way to do that locally on Linux with Eclipse. So I am looking for some simple solutions to do that locally with Eclipse using cross compilation.
I've made some researches but I can't find a real tutorial to explain how to do that, each time people say to compile on the specified platform. So if someone could help me with this that would be great.
My configuration is : Linux RedHat, Eclipse Juno, CDT plugin 8.1
You need a Linux -> Windows cross compiler. The MinGW tools would do the job, but, last I checked, they only provide binary downloads to run on Windows (i.e. not a cross-compiler). There are some (old) instructions for building your own here.
The CodeBench compiler is probably exactly what you want, but it's not free (there is a free trial though). It's basically a professional build of the MinGW tools, and comes with it's own customized Eclipse so there's no fiddling about needed in that department.
A quick google also comes up with these tools on sourceforge, but I've not tried them.

What is the difference between GTK and Win32 Native API in C?

I'm a beginner in C programming. I read about some tutorials and forums about creating GUI application in C. I encountered some terms like GTK, Win32 native API. They say that GTK is one of the library to use in creating GUI application. I also tried the code that create a simple window using Win32 API. What are the difference between them?
Thanks.
GTK is multi-platform tool kit for creating graphical user interfaces(GUI).
In short they provide a framework which you can use as an library for developing your UI applications.
Win32 API is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. These are restricted only for windows platform.
The language rules for c/c++ are governed by ISO standards which define what functionality every standard c/c++ implementation has to provide.Note that both of above provide some functionality that is over and above what the standard libraries provide.Basically, they provide you boiler plate framework for easy usage instead of reinventing wheels for your project.
Win32 is the "native" API for Microsoft Windows. You can only run it on Microsoft Windows.
GTK+ is also a GUI library. You can run it on multiple different platforms.
Qt and SDL are other multi-platform libraries. Like GTK+, the same GUI can be recompiled to run on multiple different platforms: Windows, Linux, MacOS, etc etc.
Gtk+ = cross-platform and very powerfull. more simple than win32. more tools you will have.
win32 = just in windows. standard windows GUI framework.
and DUDE! Gtk+ in windows is a pain in the ass. but for any othe supported platforms I reccomend Gtk+ for a widget toolkit.

Resources