Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
Hi I have programmed a fair amount of C++ in Windows. However recently i have seen job requirements stating that C++ programming in a linux environment is needed. Being new ...
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    67

    Question C++ linux and Windows ?? Major differences Thoughts ?? ideas ??

    Hi I have programmed a fair amount of C++ in Windows. However recently i have seen job requirements stating that C++ programming in a linux environment is needed. Being new to linux i am still acclimating to the environment, in regards to programming what are the major differences between windows programming and linux programming in c++ other than the APIs. Most of the libraries that i have com across require makefile. I believe this python based utility also exists for linux. So what are the factors that i should familiarize myself for programming in a linux envor.I used VS 2010 on indows nd am using netbeans c++ for linux..

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Makefiles and such are important, but that's not really the main difference. Makefiles are simply a way of building your software once it's written.

    The main difference is the APIs. C has a standard library, but it's fairly small. However, each platform also produces a somewhat standard library. In Linux, we call it glibc (it lives in a file called libc.so), and it has lots of functions:

    The GNU C Library

    There are also major differences when it comes to producing GUIs. On Linux, the most popular GUI libraries are Gtk and Qt.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    One of the great things about Linux, is that most software for it is open sourced. IE, you can download and review the source code. Most of the major differences are, as Cabhan noted, in the API's, especially the windowing functions. Windows display functions are very proprietary, whereas Linux uses the X11 software stack (usually accessed by more developer-friendly API's such as GTK+ and Qt). Qt is good for GUI purposes because of several facts: 1) it is the foundation for the KDE desktop manager. 2) It is fully cross-platform and runs on Windows, Linux, Unix, and many mobile devices. 3) It is fully open-sourced, and (still, but for how long?) maintained by that small cell phone company Nokia (my current employer).

    So, dig in, enjoy, and have fun! You are going to be amazed by what is out there that you can draw upon to get really cool stuff accomplished!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined! pieman's Avatar
    Join Date
    Jan 2012
    Location
    Sunny Yorkshire
    Posts
    11
    Hi Zedan,

    I sort of started the other way.

    I first started programming on Unix and similar systems in C and then moved over to programming C/C++ on Windows PCs. The main differences are the libraries that are used as obviously, C/C++ is the same language on both.

    I found that it was quite useful (certainly in the early days) to write make files on Windows and use those to control the build instead of letting Visual Studio take care of everything. I believe that if you have a good understanding of how Visual Studio builds projects, this can be useful on Linux also.

    If you're using NetBeans on Linux, you could also try to use it in Windows as this will allow you to get familiar with the IDE in a familiar environment.

    Just remember C code is C code wherever it runs and your skills should be transferable between different environments.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by pieman View Post
    Just remember C code is C code wherever it runs and your skills should be transferable between different environments.
    The biggest difference is knowing the API's for each environment. I just go a REALLY BIG book this past fall, "The Linux Programming Interface" that may be useful if you want/need to get up to speed on the Linux programming API's, though it is quite expensive.(retails at $100USD).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined! pieman's Avatar
    Join Date
    Jan 2012
    Location
    Sunny Yorkshire
    Posts
    11
    Quote Originally Posted by Rubberman View Post
    The biggest difference is knowing the API's for each environment. I just go a REALLY BIG book this past fall, "The Linux Programming Interface" that may be useful if you want/need to get up to speed on the Linux programming API's, though it is quite expensive.(retails at $100USD).
    I agree. The C standard library is small compared to all of the different APIs that are available on Linux to program against. If you know C well, you can always learn new APIs and this is what you need to do to move from programming on Windows to programming on Linux.

    The Linux Programming Interface is a really big book. Amazon are selling it at about half price at the mo though, so it may be a good buy for new Linux devs.

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by pieman View Post
    I agree. The C standard library is small compared to all of the different APIs that are available on Linux to program against. If you know C well, you can always learn new APIs and this is what you need to do to move from programming on Windows to programming on Linux.

    The Linux Programming Interface is a really big book. Amazon are selling it at about half price at the mo though, so it may be a good buy for new Linux devs.
    It's an expensive door stop, but a REALLY good one! I have just started reading through the book. It has a lot of stuff on how Linux works, and how to work with it. I will be spending more time with it over the next few months, probably.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Just Joined!
    Join Date
    Oct 2011
    Posts
    67
    I understand that there will be a few library differences like threading for example in windows is derived from windows.h . Which i dont use.. Most of my development is done using boost. However what is this i keep on hearing about being familiar with the linux stack. So far i am not facing such a huge change in environment however I would appreciate it if someone explains with an example about the difference in the linux and windows stack and how that would actually force me to alter my code ?

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I presume by stack you mean the software stack, aka APIs? If you have written using the Windows APIs exclusively, then yes, there will be a lot of changes. Some of those can be overcome by writing "wrapper" functions that look like a Windows API, but then make the appropriate calls to the Linux or standard library functions internally. However, sometimes that is not reasonable without a lot of serious work. Myself, writing cross-platform code for almost 30 years, write my own wrapper functions for system functions that have different implementations depending upon the target system. It is an engineering design issue, and should be done before the fact, rather than ex-post-facto as you are doing it. For modern systems, there are 3rd party APIs that do the same thing, such as Qt.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Just Joined!
    Join Date
    Oct 2011
    Posts
    67
    Oh okay.. So when People basically say the linux stack .. that basically would be equivalent to Windows API for a windows developer am i correct ??. So the stack in linux basically is the API in windows ?? Is this "wording" correct

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...