tags:

views:

814

answers:

7

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!

A: 

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.

luiscubal
Visual C++ has a C compiler in there, too -- not just a C++ compiler where you don't use the scary bits.
Roger Lipscombe
Use the /TC switch to get C compilation (as opposed to /TP for C++).
Roger Lipscombe
Thanks for the wxc link, didn't know about it.
Karolis
Valid C is NOT always valid C++. See http://david.tribble.com/text/cdiffs.htm .
Adam Rosenfield
"valid C is almost always valid C++". I didn't claim valid C is ALWAYS valid C++, did I?
luiscubal
+2  A: 

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.

Aardvark
+1  A: 

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.

Roger Lipscombe
+3  A: 

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!

Mike
+1  A: 

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#.

Jess
A: 

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.

Jeremy
Yeah, looks like technologies I'd like to use (a straight forward way to get widgets / controls I need and OpenCV library) are really pushing me towards C++. Uh, this may take longer than I initially thought.
Karolis
+1  A: 

You don't need anything.

Just use C and Win32 api , like real programmers, not kids..

See the VS Win32 wizard