Skip to main content
gamedev.net
🔒 Locked

Linux and Windows programming

Started by lethalhamster 6 replies 400+ views
Original Post
lethalhamster
lethalhamster
I''ve started C++ using windows. Ive completed a few very small programs, very meaningless too. I wanted to know how programming differs on like Gentoo from Windows mainly because i waned to try programming for Gentoo. I want to know specificly what you would do with like includes, and system() commands and stuff. Thanks. Please dont falme about how one if better than another, i dont care which is better. ___________________________ "It takes all kinds" -Adam Carolla
............Could Jesus microwave a burrito so hot that he himself could not eat it?
bastard2k5
bastard2k5
It depends on what libraries/environment you are using. More than likely it is a complete change of environment and libraries, well, unless you have created only console applications that only take advantage of the STL, then you would be fine moving from one to the other, with more than likely just a recompile. Gentoo isn''t a very special case versus other linux distros unless you are going to roll your applications into ebuilds, if you are doing that, then you may want to read up on the Ebuild HOWTO, and that should give you a good amount of information. For any other Gentoo specific knowledge, try the rest of their documentation here, or try their forums. Although if your stuff is in the C++ standard, then it will be included with g++, the include syntax is pretty much the same(except for case-sensitive), system(), I believe is in the same place, etc..
lethalhamster
lethalhamster
Thanks bastard2k5, I have only done consol programs. When i get into the big stuff, like acctually having a real window and stuff what do i want to use(is there a Visual C++ compiler/IDE for linux) adn i would assume that i could use OpenGL for any graphics and stuff.

___________________________
"It takes all kinds" -Adam Carolla
............Could Jesus microwave a burrito so hot that he himself could not eat it?
JTippetts
JTippetts
quote:
Original post by lethalhamster
Thanks bastard2k5, I have only done consol programs. When i get into the big stuff, like acctually having a real window and stuff what do i want to use(is there a Visual C++ compiler/IDE for linux) adn i would assume that i could use OpenGL for any graphics and stuff.

___________________________
"It takes all kinds" -Adam Carolla


You can use SDL. It provides a cross-platform means of creating a window, handling input, setting up an OpenGL context, etc... The same code, written for SDL, will work on Windows or Linux.

For an IDE, you can try KDevelop, which is packaged and shipped with a lot of distributions along with KDE. Or you could try Anjuta, a GNOME-based IDE.

For widget toolkits (windows, menus, toolbars, etc...), you have a variety of choices depending on the desktop environment you use. Qt is the widget library used by most KDE applications, while GTK+ is the toolkit used by most GNOME applications. wxWindows is a widget library that can be used on a variety of platforms, and offers a solid function base. FLTK offers a light and quick, yet fairly limited, widget set that maintains very small run-time sizes, even statically linked.

Basically, if you choose the right toolkits, you can construct applications that can be as easily built on Windows as on Linux. Such toolkits will "wrap" the platform-specific parts, providing a consistent interface and leaving the low-level details to the library.


World of Golem
lethalhamster
lethalhamster
If I use Kdevelop and QT will all the includes that go at the top be the same as in a windows program? And if there are, what parts of C++ are different in Linux. Is there any books on Linux programming you think I should get?

___________________________
"It takes all kinds" -Adam Carolla
............Could Jesus microwave a burrito so hot that he himself could not eat it?
danne89
danne89
ANSI C++ is allways ANSI C++. You dont need to buy a book on "linux programming". Take a look at the qt tutorials. They are superb! If you later want to program network apps, there are many good tutorials too.
http://www.cis.gsu.edu/~shong/oojokes/
JTippetts
JTippetts
quote:
Original post by lethalhamster
If I use Kdevelop and QT will all the includes that go at the top be the same as in a windows program?


Yes. Well, they will be if you use Qt for your Windows development as well, rather than the Windows-specific stuff in windows.h.

quote:

And if there are, what parts of C++ are different in Linux.



C++ is the same (or mostly the same; not all platforms stick to the standard completely) on every platform. The only thing that changes when moving from Windows to Linux is the choice of APIs and toolkits you can use.

For example, my game is made using OpenGL and SDL. It compiles without changes on both Windows and Linux. It would not, were I to use Linux-specific stuff like XLib, or Windows-specific stuff like the Windows API. Choice of toolkits is everything.

quote:

Is there any books on Linux programming you think I should get?


Maybe, Linux Programming Bible. It does a pretty good job of explaining some of the things you may need to be aware of when programming for Linux, and gives you a good introduction to the use of the various GNU tools (make, autoconf, Makefiles, etc.) that are pretty much a standard part of Linux development. Although IDEs such as KDevelop can do all the make and Makefile management behind the scenes, it still helps to know how things work for when you need to build packages from source and so forth.


World of Golem
C-Junkie
C-Junkie
quote:
Original post by danne89
ANSI C++ is allways ANSI C++.


ISO. I''m nitpicking.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.