Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Free of charge, simple to learn/use, Cross Platform C library for GUI Apps? Am I looking for Qt?
Bonus question: Can I develop with the said library/toolkit on Mac then recompile on PC/Linux?
Super Bonus Question: Link to tutorial and/or download of said library.
The truth is that I'm in the process of catching up on the C family (coming from web development - XHTML/PHP/MySQL) to learn iPhone development.
I do understand that C is not C++ or ObjectiveC but I want to keep the learning curve as simple as possible. Not to get too off topic, but I am also on the lookout for good starter books and websites. I've found this so far.
I'm trying to kill many birds with one stone here. I don understand that there are platform specific extensions, but I will try to avoid those for porting purposes
The idea is that I want to write the code on one machine and just compile thrice. (Mac/Win/Linux) If Objective C will compile on Windows and Linux as well as OS X then that's good. If I must use C++, that's also fine.
If you are looking for a C++ library, then Qt basically does what you are looking for. If you want to stick to pure C, then Qt is not an option.
As a C framework you could use GTK+, it works on Linux, Windows and OS X.
Take a look at the IUP Toolkit. It is written largely in C, and is also easily bound to Lua.
To complete this post Allegro has to be here =)
http://www.talula.demon.co.uk/allegro/
Allegro Game Library, have many graphics functions and a basic GUI library
And an explicit gui (and very simple) Allegro based library
http://cgui.sourceforge.net/index.html
Both multi-platform
Another option is Tk, which is a GUI library written in C. It comes with Tcl, a scripting language also written in C. These were designed from the ground up to be embedded in C programs.
One that I have considered using was the EFL, as it's quite fast, simple, small, but powerful. I would recommend diving into Elementary, their simplest GUI toolkit, and then later on, once you get comfortable with it, move to EDJE, which is not as simple, but much more powerful.
Qt is a C++ library. Other cross platform libraries that you might consider are wxWidgets (C++), and GTK (C).
All three of the presented libraries are fully cross platform. You can also look at Tcl/Tk, but that's a toolkit :).
You tagged this question about qt, which is a tag I follow. However, you are also asking with regards to c programming.
If for some strange (or domain-enforced) reason you feel you must use C and not C++, then Qt is not for you. It was designed from the ground-up as a C++ library.
Yet I'd strongly suggest questioning why your project would need to be in C. There are many benefits to C++, and the idea that C performs intrinsically better is mostly a myth. For some hard data on that, check out Bjarne Stroustrup's Learning C++ as a New Language.
If you must stick to C then there's always GTK. The underlying API of GTK+ is C, but bindings also exist for C++ called GTKmm. I'm not a big fan of it from a design perspective, but historically powered the Gnome desktop (Ubuntu's default)...and Google chose it for their version of Chrome for Linux. So it has some cred and support there.
But do note that Ubuntu is choosing Qt5 to implement their next version of "Unity" in the desktop:
https://askubuntu.com/questions/281092/why-is-canonical-choosing-qt-over-gtk-for-unitys-next-generation
EDIT: You added:
If I must use C++, that's also fine.
"Must" is a strong word, but there is practically no comparison between C++/Qt vs. C/GTK. And the latter is becoming a thing of history.
Take a look at the Ecere SDK. It offers a cross-platform GUI toolkit, and gives you eC, an object-oriented language derived from C (with all of its functionality) that is just great for building GUIs.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
After some time coding in c in a simple console, I decided I wanted to try and code an actual Win32 application. However, upon selecting the option, the sheer amount of unknown code that surfaced on my IDE (Visual Studio 2013) just to open a blank window was overwhelming, as I don't understand half of it's meaning or even what to do, since, even simple printf commands yield no result... Can someone point me to a way to understand the differences between console and application? Or at least someway I can insert my current coding knowledge in an application environment?
Working with the Windows API can be quite the experience for a newcomer. The act of opening a window does, certainly, involve a lot of boilerplate code. The good news is a lot of that boilerplate rarely changes, and when it does it'll be for very special circumstances that you can go research. That's why Visual Studio spits the whole mess out for you by default.
There are plenty of resources to learn with, including Microsoft itself: https://msdn.microsoft.com/en-us/library/bb384843.aspx
To help situate you, understand that a lot of what you're looking at that's probably confusing are typedefs used on primitive types. This helps maintain backwards compatibility with programs created for older versions of Windows, and adds semantic meanings to types. A lot of the preprocessor stuff you see in header files is actually conditional compilation - it's checking what environment you're compiling in, what version of Windows, etc. and then providing the correct typedefs so that what actually compiles works on the desired Windows platform. Stuff that's greyed out in VS2013 is stuff that Intellisense sees isn't going to be compiled based on the current #defines and a lot of it may be relatively ancient. A big part of the Windows API for a long time was a strong desire to not break backwards compatibility. This was a huge advantage for Windows, because it means my program you wrote for Windows 3.1 isn't going to be hosed by Windows 95 rolling out. Or XP, 2000, Vista, 7, 8, 10, etc. It does mean a lot of stuff makes it into the API and stays there.
They try to hide a lot of that in the headers, but you'll also see deprecated input variables to functions and the like (this parameter should always be NULL...etc), and you just have to read the documentation. Thank the internet.
For example, an LPCSTR is just a const char*, but the LPCSTR signifies that it's a null-terminated constant string. In fact, you may see that's it's not a const char*, but a CONST CHAR* where CONST and CHAR are #defines themselves to make sure the correct keywords and types are used. In your case it'll probably end up being just normal const char*.
My suggestion, rather than diving into about as complicated a C-API as possible, is to look at something like SDL. SDL is a much simpler C API designed to provide an interface to the operating system's windowing, graphics, and input, while hiding the dirty details of the API, be it Windows, Mac, or Linux. https://www.libsdl.org/
It uses openGL for its graphics. If you're making any kind of game you'll be using some kind of graphics API to talk to the video card. The native Windows graphics API is DirectX, but openGL is the very commonly used cross-platform API. Both APIs allow you to make use of a computer's video hardware to render graphics.
Edit: I'll add, since I went off and voiced an opinion on libraries, which is why these types of questions are probably frowned upon, that I think it's fair to say that SDL is the de facto standard for C third-party multimedia libraries. Also commonly mentioned is SFML, which provides much the same functionality but is more object-oriented and written in C++.
In Visual Studio, when you create a win32 app project, click on next, and click on empty project. This will eliminate all the stuff that Visual Studio creates for a win32 app, but then you start with no files. You'll probably want to start with some simple example C program for windows from a book or web site.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I'm learning C and I would like to start graphics programming, but start it simple, without spending hours just to understand what functions will I need.
I would like something to draw pixels, squares, maybe sprites, simple stuff, like in BASIC.
I tried SDL and got overwhelmed very quickly. Same with Allegro, it's hard to get it to work on Xcode 4 and documentation is lacking.
Maybe there is some custom one? Also would be nice if it works on Mac OS.
Any book recommendations are welcome, like simple C graphics programming or game programming, whatever.
If SDL is overwhelming, perhaps graphics programming is not the place to start in C. If you want to get familiar with the concepts involved in coding up graphics, try it in a higher level language like Python (with pygame or pyglet.) Most high-level languages have good bindings to graphics libraries. If you really want to learn C by writing games, maybe something more text-oriented (ncurses-based?) is appropriate.
Once you understand the fundamental idioms of graphics programming, applying them to different languages becomes much easier. You'll be able to go from pygame to SDL in C without too much extra pain beyond that inherent in going from Python to C.
I'd go for QuickCG. Here you can find sources and some tuts.
The best you can use at least which is both portable and now almost an industry standard, simple graphics can be done using OpenCV. This is not limited to just drawing lines or primitives, or should I say simple graphics, I have used it for industry standard image processing products and computer vision problem solving. This will be fun if you start learning it. OpenGL is also another place to start. It might well suit what you want. Mostly related to graphics, rather than computer vision or image processing
Another option would be to investigate the Postscript language to get a feel for the stencil/paint image model. And then you could more easily get started with Cairo which implements the same model. A big advantage to the stencil/paint model is device independence. With Cairo you can perform the same drawing commands to output to a window, an in-memory pixmap, or a pdf file writer.
"g2 graphics library" is the most simple. The programming language is C. But does not support "only" 64 bit systems (it supports 32 bit like Mac OS Mojave, and Ubuntu, have not checked up with Windows MSYS MinGw). To create User Interfaces i recommend FLTK (Fast Light Toolkit) with the UI-builder Fluid.
https://sourceforge.net/projects/g2gl/
https://www.fltk.org/software.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
There are websites as collections of python/perl/R libraries. Why there is not an equivalent one for c?
I searched the internet and only found a small website calling itself CCAN. There are only a few libraries in that website.
If I need extra libraries for c programming, where can I find them? Is there an well organized website of the c libraries?
Thanks.
If I need extra libraries for c programming, where can I find them? Is there an well organized website of the c libraries?
No known to me outside of CCAN.
The problem here is that C doesn't have any even loose specification for libraries. Compare that to e.g. packages in Java or Python or Perl.
And even then, C is quite bare bone itself leaving many things for libraries to implement themselves. I/O abstraction, memory management, multi-threading, OS integration - minor differences in how libraries work with any of the resources might make them incompatible, preventing them being used in the same project.
I have seen in past some 3rd party commercial libraries for C, covering quite a lot of functionality, but frankly I can't recommend them and honestly do not even remember their names - for they often were causing more problems than really helping. (OK, I'm lying: they were rarely causing unsolvable problems: it's the numerous workarounds which were causing often the problems later.)
Otherwise, for C you might want to check the Glib and (do not get me wrong) to also check the C standard as in my experience few actually know many of the utilities already in the standard library itself. And well, Google is your friend: lots of public domain code is there for you to simply throw as-is into your project.
I don't know of anybody who's studied this in detail, though I would be curious to see the studies. I'm sure it has to do with the nature of the C programming community itself.
I think a large (maybe the primary?) part of the answer is: before the WWW, there was no such thing as a single resource for obtaining libraries for a particular language. People obtained their libraries, and knowledge of libraries, via many different means: through BBSes, mailing lists, newsgroups, and periodicals. The C community dates from this time, of course, and I've noticed a similar difference in culture regarding other languages from this period and before.
I think another part of the answer has to do with the general decentralization of C culture itself. There's no one C compiler, no one C development community, that serves as a hub and a potential point for projects to attach themselves to. And the C development community is huge, which further drives this decentralization and splintering.
In the case of C libraries, OS distributions actually do a pretty good job of collecting useful C/C++ libraries out there. (With the unfortunate exception of Windows, I believe.) They do a better job in these languages than most others, probably since C and C++ are such important systems languages on these platforms.
As far as CCAN goes, I think what would make a more worthwhile project, given the number of different distributors of C code out there, is to have a single site that links to the various libraries on their own native sites, rather than trying to get them to upload straight to CCAN. I think there's a use for this in and apart from Google, which will give you a lot of noise if you try just browsing for libraries. The question is, would you and the bulk of the C communities out there embrace such a site if it existed?
You might be amused to see how CPAN got its start: http://www.brainbell.com/tutors/Perl/CPAN_History.htm
CPAN evolved just as its community did. So the same thing could happen in the C/C++ world if the leadership and interest is there. But it hasn't happened yet.
use http://www.google.com/codesearch?q=lang:%22C%22 variant of http://www.google.com/codesearch
=> i.e. add lang:"C" in the search query
Use these web-sites:
Debian "Testing": Subsection libs
The Free Country: Free C/C++ Libraries
Free Software Directory: Category/Library
SourceForge Software Map: Software Development/Libraries/C
Upstream Tracker: List of C/C++ Shared Libraries
There is a Maven-like repository and dependency management system called Biicode.
There isn't a huge collection of libraries on there yet, but you can add forks of open source projects yourself or inform original authors about it.
EDIT: the company behind biicode is dead
EDIT2: the spiritual successor seems to be conan.io
There is a C package manager which looks promising called CLib:
github:
https://github.com/clibs/clib
tutorial:
https://dev.to/noah11012/clibs-a-package-manager-for-c-4jmi
Why do you need a website for a collection of C libraries? Just use Google.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I've took C programming class while back ago. Since I'm done with the class and don't have any access to the school lab anymore, can anybody give me suggestion how do I practice my c at home. Thanks
Code a little game like tic-tac-toe or pong. Lots of fun and a sense of accomplishment when you are done, but complex enough to keep you working at it for a while :)
There are also code competition sites like topcode at google and such to keep practiced. Heck, code kata could help as well. Like playing an instrument, you must keep practicing to get better. Ideally, you'd get an entry level / internship position to further improve your abilities under a mentorship.
If you lack a compiler, microsoft has a free version of the latest dev studio available for download. It can do c, c++, c# and anything in between. Also, the suggestion of gcc is a good one as it is widely used in various open source developments over at source forge - another place to go and sign up for a project and help out a group project.
Try solving some ACM programming contest problems using C.
http://acm.uva.es/
Writing code for the judge and submitting it is lots of fun.
I assume you have a computer at home. Is your question about access to software? If it is Mac or Linux, then it already has a gcc compiler. For Windows, you can download mingw or cygwin. I believe Microsoft also have a free version of it Visual C++ for download.
The best way to learn a programming language is to use it. Many times at home you sit there and realize that there is some utility that you could write that will make your life easier.
I don't recommend coding games that require an API or such as it will just confuse the matter. You would ideally like to learn the language a bit better before attempting to learn a Graphics API.
The first c exercise I had fun with is solving a maze. A maze looks like this
********** 0
* * *B * 1
* * **** * 2
* * * * 3
* * * ** * 4
*A * * 5
********** 6
0123456789
so on a 10 x 7 array, A is the staring point (column 1, row 5) , B is the destination. * is wall and space is road. The objective of the program is to print every coordinates of the shortest path from A to B, e.g. 1,5 -> 2,5 -> 3,5 -> 3,4 -> ...
if you are looking for a compiler, MingGW is free on Windows.
Your question may be understood in several ways:
You don't know how to have an environment to deal with C at home
This is partly a matter of opinion, but especially for C, I think linux is a good environment. C and Unix are tied together after all. You will need gcc, make, etc... I remember when I started learning C as my first programming language at school, nothing made much sense (separate compilation, linking, make, etc...), and I don't know where you at there.
You want a project to practice C at home
I will assume you know how to use a typical environment to build C software. I think the best is to get into an open source project. C is a widely used language in open source, and finding a project which is both interesting to you and in need of manpower should not be difficult. Starting a project from scratch is what you do at school, and getting into a "real" project will make you learn much more useful thing than doing the same thing at home - dealing with source control, dealing with bug tracking, dealing with people :) There is a steeper learning curve, if only to get involved in the project proper, but I think it is much more rewarding, especially if it is a widely used project.
C is usually used for low level stuff, but besides obvious (and rather difficult) things like the kernel, there are language runtimes (diving into Python C code for example is not too difficult), audio/video editors (ardour, etc...), etc...
Just write and run C programs at home, how else would you practice? ;-)
I suspect that, although you didn't say so, you're wondering about how you can get the necessary tools to compile a C program on your own computer - am I correct? If that's the case, know that all the tools you need to develop C programs are available online for free. The most important is a compiler, of course, and one of the most popular compilers is GCC. If your computer runs Windows, I think you can also download Microsoft's Visual Studio for free (or some edition of it, at least), and I believe that would include a C compiler.
You'll also need an editor or IDE. At a bare minimum you could do it in Notepad, but that's inflicting unnecessary pain on yourself. Notepad++ is a popular alternative that's good for programming. Or if you're using Visual Studio, that has its own editor. (Actually VS has pretty much everything you need, as far as I know - I haven't used it much myself)
See c-on-visual-studio for discussion of the Windows environment.
Microsoft provides a free version of visual studio, Visual C++ 2010 Express.
Supplementing the other answers, if you're on a beefy Windows machine you can run something like Ubuntu in a virtual environment like VirtualBox to get a sandbox that's built to run C programs.
Install ubuntu or debian.
After installation do:
sudo aptitude install gcc
Or alternatively install some other C compiler.
Now you're capable of compiling C source code to binary which you can run.
Consult the manual of your compiler for usage and learn how to write shell scripts for constructing build-scripts.
Begin with solving basic level logical questions, and while solving always follow the best approach and best practices.
You can refer and try solving these fundamental question : C programs
Also try solving questions of : Project Eulers
A really good way to exercise C is to read (or reread) The C Programming Language (K&R) and to do every exercise at the end of each chapter.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Any online C compiler that you know which can do the following:
Compile and execute the C programs online
File handling
System functions like exec(), system(), fork()
Or any compiler which does not need installation procedure (I mean that you can just copy paste a folder to run the compiler easily)
Note:Please do not propose Turbo C.I know some online compilers at codepad.org (gcc).
I was using codeide.com but its out of service now I think.
And as asked above online compiler will be a best advice that you can give for me.
My environment is Windows ... Thanks in advance.
Any advices on other Language compilers are also invited
Just install something like tcc. It's seriously not worth messing around with an online compiling site if you're going to be compiling files on any sort of regular basis.
Comeau has an online C/C++ compiler, but it's mainly to evaluate their compiler.
or cygwin
I'd rather recommend to install cygwin, you'll get an unix-like environment, with gcc. Then setting up a Makefile - or even just a shell script - to be able to compile is not a big deal.
You asked for other languages: Here's one for Lisp (not a compiler, but an interpreter)
Online Lisp interpreter in Flash
rextester
Maybe my answer is a bit late, but we have created an online compiler and IDE where you can run and create your files using just a browser.
At the moment we support a few languages (C, C++, ObjC, Java, Pascal, Fortran) and a simple file system, but we will enable many more features for better coding and debugging during the near future.
All the features offered at the moment are completely free and there is no registration needed (you can register though in order to keep your files online).
You can try our service here: www.sourcelair.com
DJGPP Public Access Cross-Compiler (C/C++, DOS32, based on GCC)
yet another online compiler:
http://cmpe150-1.cmpe.boun.edu.tr
It supports sytax highlight, indentation etc. I wrote it as a part of my MS thesis
PS: did not test fork command
We have another compiler for C and C++ here: http://www.codepad.org/
I have nothing for C. For other languages, this is a ruby interpreter. But honestly the best online development environment is the browser itself. Javascript is an advanced language. Combined with technologies like CSS and DHTML and frameworks like jQuery or Prototype you can build graphics applications. It is not hard to find debuggers (like Firebug) also.
Of course you can't interact with the file system. To overcome this you could write a plug-in for a browser (notably Firefox). There are many resources available for this and although it is not as straight forward as pure javascript, it is easier than most people believe.
For Python and Sage, try out http://live.codenode.org. It is also open source under the BSD license, so you can be download and run it from your own computer, more info is here: http://codenode.org
just a sudgestion.
I do not know why you do not want simply to install a compiler. However did you considered the possibility of using a portable one?
http://en.wikipedia.org/wiki/Portable_C_Compiler
best,
Ste
One of the better lists for C++ is isocpp Getting Started page. Unfortunately Cameau's seems to be disabled for now. LiveWorkspace has been in maintenance mode for a while and it is not clear when it is coming back, which is unfortunate since it has a simple interface and when it was working allowed you to switch between gcc, clang and intel very easily.
Of the ones that are left Coliru is the most powerful, you have a full command line available and you can save files and therefore uses multiple files in your project.
The isocpp list somehow is missing codepad which although rather primitive along with Coliru allows you to use boost.
Coliru, ideone and codepad all support many other languages as well. The list of languages supported by ideone and codepad is pretty large and is obvious on the main pages with Coliru you don't have a list but besides C and C++ it also supports python, perl and ruby.