Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

C/C++ and GUI

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have time on my hands since I retired. I took a JAVA class and after wrote a GUI-laced APP which works well.
I would like to rewrite it using a C family Lang (again, time on my hands). From what I can see, neither C or C++ have imbedded GUI like Java. Is this correct? Is there a way to use a 3rd party product?
If neither can do it, then I will go no further down this road.
Thank you. Bob
 
Saloon Keeper
Posts: 11918
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell us what kind of user interface you want to make and for what specific operating system.
 
Ranch Hand
Posts: 146
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert - if you google 'c gui library' you'll see that there are a number of options. But no, it's not as easy as Java.
 
Saloon Keeper
Posts: 21998
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bob, how's the lockdown?

You should have taken my C course at FCCJ back when like Rich did.

Actually, that's where I learned that teaching isn't my forte.

C comes from a time when support libraries for operating systems were minimal and GUIs were essentially non-existent. One of the first GUIs developed, in fact, was the X system from MIT. X was actually a software component that sat on top of the OS, and wasn't actually part of the OS, and that's how it remains to this day. X gets its name from its predecessor, which was W (presumably for "window"). Unix people have offbeat senses of humor. What's more, X has been Version 11 since 1987, so if you thought the mainframe world was conservative...

To program GUI applications in X, an API library was available. X is based on a client-server protocol, where the "server" is the machine that you are sitting at and the "client" is the machine you are logged into. And since Unix has always been a multi-user OS (unlike Windows), that meant that multiple remote users could all have their own private GUI displays.

X is actually just the GUI primitives, so frameworks such as Mesa were developed to add smart controls and other amenities to it and desktop manager programs created to help provide a consistent "working surface". Unlike the old Macintosh and Microsoft Windows systems (even today), the Desktop is a selectable feature. The two most popular at the moment are Gnome and KDE, but there are probably more than a dozen others. I use a Gnome-derived desktop called Cinnamon, in fact, because the transition from Gnome 2 to Gnome 3 dumbed it down to the point where I was missing some of my most essential features.

I bought a book on X programming probably about 1990, but I don't recall ever actually writing a native X app. Most of my Linux GUI apps are either in Java or Python.

On the Macintosh, the windowing system was part of the core ROM and an essential part of the OS. It actually cost money to get a classic Mac supplied with a command-line interface (named "commando"). So GUI programming there was just part of developing with the Mac SDK.

On Windows, again the windowing system is part of the core Window system. Originally Windows was a program that you launched from DOS (up to and including Windows 95), but the XP version of Windows was based on technology lifted from DEC. Which was good, because the DEC technology was true multi-tasking and the DOS technology had to do horrible kludgy things to multi-task. Windows was originally based on 3 DLLs - kernel.dll, gui.dll (?) and one other which I forget.

Regardless, the Windows developer kits came with the full GUI development package. Although these days, the preferred Language Environment for Windows is .Net. The .Net APIs were originally based on the C APIs, though.

Coming back to Linux, though, one of the biggest challenges to developing GUI apps there is in figuring out which GUI toolkits you want to use. There are just so many of them. A GUI app for Linux is not for the faint of heart. I did some mods to a CAD program I like called FreeCAD and I could build a Linux OS kernel in less time than I could do a full compile of that one app.

At least one thing. There is a lot more support for C++ now than there was for the old-time C and early C++. We have the Standard Template Libary and some very nice support packages such as Boost. Still, C/C++ is a treacherous environment and its great rewards come at great cost. And yes, C/C++ apps can core dump.
 
Robert Houston
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, Thanks for your response.

Tim, is there anything you don't know about programming? You should pick up Chinese and help the CIA combat the Chicoms. And while you're at it, find a way to kill the Corona.

Anyway, I'm currently using Code Blocks as my IDE for C, in Windows 10. After reading you comments I went back into C.B. and see that there is a way for GUI. It requires activating an option and downloading the libs. We'll see.

Again, thanks to all.

Bob
 
Tim Holloway
Saloon Keeper
Posts: 21998
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eh, combine ADHD with no distractions from raising a family. Add a strong incentive to learn up-and-coming tech to avoid having to move to New Jersey to get a job. It adds up.

I bought a Commodore Amiga right after I left CPI because it had a built-in GUI, audio/video and real-time 32-bit multi-tasking OS. Read an early article about C++ and found out that via the wonders of Capitalism I could license it, port it to the Amiga, and re-sell it using Lattice/SAS as the actual vendor with me as VAR. The Amiga was ideal for this, since all the other popular PCs of the day were still hung up on 16 bits and the Intel segmented memory model was an especially poor fit. And actually, I almost totally skipped the DOS era. Don't know if you'd heard but I spent 2 years as a Mac developer down in Orlando, then worked with an early IBM PC C++ in Largo before returning to Jax. Picked up a Linux CD at the local Hamfest and went on from there.

My IDE of choice is Eclipse, which was originally an IBM product before it went open-source, and IBM continued to market it under the Rational label thereafter. For all I know, they still do. The only IBM product I've worked with for many years has been Red Hat Linux.

I like Eclipse, because although it's written in Java, it has plugins for virtually everything. I'm using it to do C++ development at the moment, in fact. There's even a COBOL plugin. It also has the ability to debug multiple applications running - and talking to each other at the same time. Us systems-level geeks appreciate that sort of  thing.

On Windows I used Visual Studio with Visual C++ and Borland's product before Borland exited the market. There's a free version of Visual Studio these days, although it's apparently not as powerful as the paid version. Used to be that VS wasn't that expensive to buy, though, especially compared to anything with "Rational" in the name. Not sure anymore. I think you'll find some Code Blocks fans around the Ranch, though.

The Windows GUI in its base C model was based on "handles". You had an hWin to be the handle for a window, for example. Although if my memory isn't too fuzzy, there was a way to translate them into C++ objects using Visual C++. The full documentation is available online, though.

You shouldn't need anything extra to program Windows GUI C++ as long as you can build, link and run an EXE file or .Net assembly. Probably the extra plugin is helper stuff to keep from re-inventing common functions. And maybe a WYSIWYG GUI designer.
 
Tim Holloway
Saloon Keeper
Posts: 21998
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yeah, Coronavirus is simple. Just issue everyone a can of hairspray and have them let loose. Destroy the Ozone layer and all that nice heavy sterilizing UV comes through - it'll be like a miracle! Take THAT, tree-huggers!

Actually, two of the servers in the mousetech farm are part of the folding @home project doing heavy-duty computing work on modelling not only coronavirus but other biological problems such as Alzheimers. My desktop machine also is part of that network, but since I've got it set up to sleep when idle it only runs in the background when I'm working with it. The servers were going 24x7 anyway and only at about 5% capacity so I figured I'd donate the rest to a good cause.
 
Robert Houston
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Tim, one last Q. If I want to rewrite a JAVA app which uses GUI, should I first learn C or go straight to C++?
 
Stephan van Hulst
Saloon Keeper
Posts: 11918
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally I'd ask you why you would want to rewrite a Java application in C/C++ in the first place. Usually it's the other way around.

Seeing as you're doing this to kill some time, I suppose it doesn't really matter. Personally I'd use C++ because it's slightly less horrible than C, but if you want to challenge yourself you could do it in C.
 
Tim Holloway
Saloon Keeper
Posts: 21998
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I'm not sure if you're really using C++ or if you're using Microsoft's C#.Net.

The whole .Net system is the result of what happened when Microsoft started lifting things from Java. First, they tried hijacking Java wholesale replacing it with a bunch of Windows-only classes (and thus violating Java's "write-once/run-anywhere" principle). That was J++. Sun sued them silly and they lost, so J++ is history, and Microsoft has never loved Java since. But they took some of the general concepts and applied them in a manner similar to what IBM did with LE/370 to create .Net.

While C is sort of a subset of C++, I don't think it has been general practice for developers to use it that way, so that makes the answer easy. Code like C++.

I could be wrong about your using .Net - I think that, for example, the gcc/g++ language environment runs native on Windows, and certainly can under cygwin. And there are probably commercial C/C++ compilers from companies like Intel for Windows. But most Windows C/C++ developers are using .Net. The exception being people developing cross-system apps like FreeCAD where the code has to run natively on Linux, Windows and frequently other OS's such as Apple IOS, BSD Unix, and maybe even z/OS.

BTW, I once talked to Merrill Lynch about a new position they had created that required mainframe Linux. I figured at the time there probably weren't too many people in this backwards town that could claim extensive experience in both, but they laughed at me. I think it was in part because they were asking questions about SuSE, even though they were planning on running Red Hat. HR. Meh. I hope they enjoyed whoever they hired.

I also created an IMPL cd on one of those 3-inch mini-CDs right about then. It actually ran Damn Small Linux, but when you powered on the machine, DSL launched the Hercules mainframe emulator, so the box became an "IBM System/370". Had TSO, FORTRAN, COBOL and PL/1 on it and about 5 3270 terminals. Plus, of course, a card reader/punch and 2 3211 printers (all brought out via TCP/IP ports).
 
John Matthews
Ranch Hand
Posts: 146
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Personally I'd use C++ because it's slightly less horrible than C

...or more rope to hang yourself with, depending on how you look at it
 
Robert Houston
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice history lesson perfesser.
So it's C++, I think.
 
grapes are vegan food pellets. Eat this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic