ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to learn this linux and its C/C++. I have downloaded QT creator as an IDE. . ..but still having problems.
I only need a little kick in the fanny, and things will come together.
I have 35 years programming experience in C and C++, using Borland's and Embacardero compilers. ..from Turbo c/c++ to their latest RAD Studio.
What I did, was used the QT creator, and put 2 push buttons and 1 line edit field on the form.
The only thing I want to do, is to push one of the buttons, and allow that button to place something in the editline field. It took me a while to find out that "Go to Slot" was part of what I was looking for. (smile).
Heck yes, Turbo C/C++ when it came out, was a wonderful DOS compiler. . . Amazing that it fit on a floppy disk or two. I have been with Borland since then. I was also Beta Tester for Teseract that used this same compiler for their stuff.
I wish I still had my copy of C/C++. . .I thought I saved it, but I guess I didn't get all of it. It had such a primitive debugger, but it worked surprisingly well. I know I have everything of Borlands AFTER Turbo C/C++ (I think it was Borland Turbo 3 that came out with a new fancy IDE. then when all the way up to T/C version 5 before it switched to Borland C builder.
My main BCB is version 5. I use RAD XE8 for customers, I haven't purchased RAD XE10. I doubt if I will. I am about to retire, and don't think it is worth the $$$$ dollar upgrade. By the way Embacadereo just got bought out about 1 month ago. . .I am not sure how long the XE's are going to last.
Anyhow thank you for your help. . .worked like a champ. . .I just have to get used to the idiosyncrasies between the different compilers. I would like to transfer a few of my programs to Linux. They run well in Wine, and my older ones will run well in DOSBOX, but I would rather have it in Linux.
QT doesn't recognize "open" or "close".
Nor does it recognize the binary statements:
O_CREAT - create if doesn't exist
O_BINARY - open as a binary file, not ascii
O_TRUNC - truncate size to zero if exists
S_IREAD|S_IWRITE) - Open as read and write.
Thus, I can't find the header for open and close, so none of my open/close statements make any sense to the compiler.
What header should I use? or is "open/close" valid in linux?
gtk is a C library.
but OOP like C with a own set of libraries.
like all tools kits it require some time to get used to it.
but you have to start with the provided documentation and samples provided by the tool kit, no matter if you use Qt gtk, gtk++ fltk fox wxwidgets, .... whatever
not that I did much in Eclipse, beyond coding in Java; QtCreator is actually a very, very nice IDE to write (portable) C++ GUI code.
So far I have not been able to get write a C GUI-thing in Eclipse;
A nice designer for the layout of the window, buttons and all the fields... Eclipse does have that for Java; but I have not been able to get something similar for C or any other progamming language that Eclipse can help with... Eclipse is a really nice framework; but I tend not to use it for C(++)
but, like all it does take a bit of learning (although, imo, the learning curve is not really steep, especially if you already have some experience in others)
The QT documentation is quite nice, fairly complete and provides examples... not much more than I can wish for.
don't use eclipse from some repos, download, extract run it
it does of course not have the GUI interface designer for ..(place gui toolkit here),
but many projects do not use the GUI interface designers anyway
or you desing your interface with ..(place gui toolkit tool here) and do the coding in eclipse.
but of course, Qt creator has, especially for QML, extra tools that can be nice and for working through the tutorials it is excellent.
from point of working with C++ code it's not that feature rich as eclipse, eg spell checking for comments, re-factoring, show implementaion of function in overlay, ... but as said, there is no need to restrict you to one IDE, using CMake they can work pretty nice together
Don't use Qt Creator to learn Qt. Every example and help I've received from Digia (original creators of Qt) was code in C++. Look at their examples. The creator makes up this abstract project, and while it's all nice, when you say stuff like "I want to change a button's behavior" all the results I usually find are code examples. (Actually you see a lot of them in Stack OV ...)
When you look at the documentation about a button you see it inherits widget attributes, and from there you can see all the properties and methods each of those support. Stay within the library properties and you'll be fine.
I've used fltk and that works fine too, but it is much more limited and they seemed to have stopped development with it.
I'd start with the Qt hello world example and as others are saying, stay within the Qt library and stop trying to match this all up against Borland which is more than 20? years old.
All my life I have been using Borland products and embarcadero products. . .all for windows. Ever since Turbo C/C++ version 1. from borland.
Most of my code I believe will work, I just need to figure out the classes to convert QT to basic C/C++ and convert back. I also need to figure out some of the idiosyncrasies. between the two C/C++ languages. . .
For example
strncmpi and strcmpi does not seem to exist in linux. So I wrote a simple subroutine to make them compatible for linux
Code:
int comparestrings(char *a,char *b)
{
int d,e;
// char tt[10];
for(d=0;d<strlen(a);d++)
{
if(a[d]==b[d])e=0;
if(a[d]>b[d])e=1;
if(a[d]<b[d])e=-1;
if(e!=0)d=strlen(a)+1;
}
return e;
}
I just need to figure out how to convert in and out of Linux's C/C++ QT, and I will have it made.
Unfortunately, it is rather difficult to find the routines I want over the QT website. . .I am either looking for the
wrong syntax, wrong routine, or something simllar. . . What has helped tremendously, is when folks give me a link to a routine, and I find that the routine wasn't what I was looking for, but SHOULD have been looking for. <Very Big Smile> Then I can kind of go from there.
I am a customer programmer for a large Lumber Co. been there for almost 40 years, and have written their complete accounting system in C/C++. But about 3 years ago, I started playing with Linux. I have been very impressed with what Linux has become. My main operating system is linux now, and I use VMPlayer for my Windows Shell now. Thus I can run 3 or 4 OS's at the same time. I usually have 3 OS's going at once. Linux my main. Windows my 1st. and Linux as my second and "internet surfing" OS. That way I am isolated from the LAN network and the WAN network.
I have a few programs I would like to port over to Linux. They run quite well in WINE, but I would rather have them written in Linux C/C++.
The two have their idiosyncrasies, but it is a opportunity to better myself in Linux. My knowledge of Linux is STILL very naive. I have much to learn. Thus, I have to learn it on the side after my other work is done. As I get older, sometimers sits in... I will sometimes forget what I have learned a year ago, and have to relearn it again, because I never use it. Oh well. . .
I will have to work on building up small subroutines to help me convert some of my programs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.