Linux to Windows C++ port [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am trying to port my C++ application from Linux to Windows (Visual C++).
I am just curious wheter you know about any script/tool that would scan the source code and check for possible issues (such as dirent.h etc).
Thanks.

The first tool is called your compiler. It will tell you if your program compiles.
The second tool is called running whatever tests you may have. They will tell you if the resulting binary works.
What were you looking for, a crystal ball to save you from doing work? Regardless of what approach you take or what you may read to help you get started, you will at some point have to (1) compile the thing and (2) check to see that it works.

Microsoft has an entry on the MSDN about the 'best' ways to manage a port from *nix to Win32.
http://msdn.microsoft.com/en-us/library/y23kc048.aspx

http://www.mingw.org/wiki/msys or http://www.cygwin.com/
edit:
Cygwin is essentially a compatibility layer (implemented as a dll) between Unix/Posix and windows - the code should be unchanged, but there can be issues between different version of the cygwin dll.
Msys+Mingw is a subset of Unix/Posix libs reimplemented in win32 and a port of the gcc compiler plus essential build tools. The resulting exe runs completely natively but some complex build procedures need more work.
Either way if the app uses X then you also need an X-server, both of these provide one. But if you are doing lots of graphics and the app is written using something like Qt or wxWidgets you are going to have a reasonable amount of pain getting it to work.

First, I would just compile using MinGW (at least at first), to eliminate any possible gcc to MSVS issues (not to waste time with compiler-related issues).
Second, just compile the code and watch all the include files that were not found. Go to the code that includes those headers, figure out if it is a dependency that exists in Windows (but was just not installed or set in include-paths). If not, use cross-platform libraries to replace the non-portable libraries. Typical cross-platform libraries would include: Boost, OpenGL, SDL, Qt, etc. (depending on how much your application is doing). If it is just a command-line "number-crunching" software, you will probably find all you need in Boost.

Related

Why is win32 API non-portable? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I know that win32 API is written in C language and also why Qt is portable?
Could someone explain this to me?
Because WinAPI was not designed to be portable as it targets only the Windows OS while the QT framework targets multiple OS-es. The fact that WinAPI was written in C does not make a difference.
The windows API is portable in the sense of being processor agnostic (indeed, it has run on many non-Intel processors over the years). It is not portable in the sense of being OS agnostic; although even there Microsoft's is not the only implementation of the API. The wine project has done a credible job of re-implementing the API for other platforms, to the point that windows binaries will run, at least on processors that match the binary.
The fact that the WinAPI is aimed at C makes no difference.
Just because the language is cross platform it does not mean the library (especially in the case of those like WinAPI which are not in the standard library) are the same.
It's just a library that interacts with the video card/processor to make a GUI on a very low level. At this point it is so low level the process depends more on memory locations or processor specific operations. IE saying that certain memory locations (specific to the OS) will reference a pixel on a screen ect.
The Win32API has been built so that it only "knows" the tasks for computers with Windows OS, libraries like QT, once again are still not truly "cross-platform" they have just been built to include all the relevant operations needed for each OS it covers.
Why is a rather open question; but here's my take on it:
Win32 API is produced by microsoft; which has commercial reasons for not being portable.
QT is open source; which was created with the sole intention to be portable.
Bonus:
X11 is open source; which was created with the idea that the machine displaying the images might not be the machine running the program that wants the window. Which makes it inherently non-portable to other APIs that don't (eg windows)

Framework for a C++ application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to create a standalone C++ desktop application which will be close-source, commercial and will not require the user to have the required DLLs in the machine.
It has, at least, to work for Windows. If it can be built for all platforms, that would be awesome.
This means I do not want the application to use the .NET Framework and all required DLLs must be shipped with the (only) executable the client will download.
I found and tested a dummy MFC application, it seems possible to do everything I require, but every comment I hear about MFC is that it is bad designed, about to be obsolete, bad choice, hard to use, etc etc etc.
I see lots of people recommend Qt, but I read that I can't ship the library unless I pay a commercial license, or the application has to be open-source.
wxWidgets, from what I read, seems to follow the same bad design of MFC.
However, many of the comments I read seem to be for years ago. It seems that Qt has changed its license, so something may have changed in the meanwhile.
If you were me and had these requirements, what framework/library would you pick and why?
I see lots of people recommend Qt, but I read that I can't ship the library unless I pay a commercial license, or the application has to be open-source.
This is wrong. Qt is available under the LGPL license, which means you absolutely can ship your application closed-source, as long as you provide a way for the end-user to be able to modify/update the Qt dependency. Typically this means using a shared Qt library and deploying the DLL files with your application, so that the end-user can replace the DLL files if they wanted to. However it is also possible to link statically in which case you must provide a way for your end-users to re-link it. This means that you'd have to ship compiled code (object files) with your application as a minimum. Note: I'm not a lawyer, and you should thoroughly investigate the license terms yourself before you make any decision.
However, many of the comments I read seem to be for years ago. It seems that Qt has changed its license, so something may have changed in the meanwhile.
As far as I can tell, Qt added LGPL as one of the available licenses in version 4.5 which was released in March 2009. So yes, those comments are almost 4 years out of date.
Note: Apart from the specific points I've addressed, it is hard to answer your question more generally for two reasons - (1) this site considers posts asking for recommendations to be off-topic, and (2) you've said, "if you were me and had these requirements, what framework/library would you pick and why", but you haven't actually said what those requirements are - it seems apparent that you want the library to be able to do GUIs, but what else? There are many different frameworks and libraries for C++ and they all do different things.
I really don't see what's the problem with Qt. I agree with what JBentley said - it implies that it would be in fact a good choice if you're looking for a modern framework. Qt offers much more functionality than MFC.
There is no problem shipping commercial, closed-source, statically linked applications that use Qt. Been there, done that, and it works just fine. Single .exe is all you provide. I'm not a lawyer, but generally what you need to provide on request is a static .lib file generated from your code's object files, so that it can be re-linked by the end user with their own copy of Qt.
There's nothing bad about that from a commercial standpoint -- if you can't afford the cost of a commercial Qt license, the requirement to make a .lib file if your compiled closed-source code shouldn't be a big deal. Make it a part of your build process, so that it's not an extra burden. You don't need to distribute this .lib file, just provide it on request. It doesn't have to be recompiled for the requester's platform or anything like that - whatever compiler you use to compile Qt and your application is all you need.
If one is serious about it, one will ask an IP lawyer to explain the implications of the licensing terms of any software you intend to redistribute with one;s product. So it doesn't matter if it's Qt or MFC, one goes and asks a lawyer. It's not like somehow LGPL implies "go to a lawyer", but a possibly much more complex Microsoft license doesn't. Unless one's stance is that it's OK to ignore MS licenses, but not OK to ignore FSF licenses :/
Have a look at these: http://en.wikipedia.org/wiki/List_of_widget_toolkits
Maybe SmartWin++? http://en.wikipedia.org/wiki/SmartWin%2B%2B
Cheers
MFC is alive and well and will meet your requirements. I (still) use it frequently. If your app GUI is basic and does not need most of the MFC features then ATL would be a very good choice. Both MFC and ATL can be statically linked so no DLLs need to be shipped with the app.

light-weight C++ image library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've been looking around for a simple and small yet robust and fast (not comprehensive!) image library for C++ (C would suffice, if no C++ version is available).
Main features I'm looking for are:
Free (opensource is a plus)
Built for speed
No huge functional bloat (like ImageMagik, which is truly comprehensive but is a mammoth)
Tiny memory footprint
Only supports the absolute minimum of functions like load/save, resize, convert between formats. Nothing fancy
Error recovery for "broken" files (unlike stb_image.c, which has pretty poor error recovery)
MSVC and gcc friendly (I used CxImage for a number of years but with the latest version I'm having problems with MSVC 2010 and it would seem that active development and support for it has died out by now, so I'm about to drop it)
Should support popular modern formats, like JPEG2000, either directly or via a use of general libraries like libpng
Don't care if it's DirectX or OpenGL as I don't plan on using it to display the images - only to file-process them for a web site
Having support for both static and dynamic linking is a plus
Threading support is a huge plus
Libraries I looked at and dismissed for one reason or another:
CxImage (no active development on it anymore)
ImageMagik - too huge (and slow)
stb_image.c - bad error handling, doesn't support enough image formats
DevIL (havn't dismissed yet, but haven't looked at it much either - just learnt of it a few minutes ago on a similar post on SO) - based on it's size and feature set it looks very promising for what I need though
FreeImage (same as DevIL - will take a look at it shortly but it's a bit big in size to my taste)
SOIL (same as stb_image.c)
TimThumb - it's a PHP, not a C/C++
In short I just want something as tiny as possible and as fast as possible at the expense of just having the absolute bare minimum of functionality but I'm yet to find a suitable candidate thus far.
Any suggestions from this community, please? But keep in mind the constraints I listed above - I don't think it's OK to throw an answer of a form "have you tried X?" where "X" doesn't meet half of my needs :)
Edit: Looking a bit more into DevIL it would seem it could be what I need. It's light, tiny, robust. Now I just need to make sure it performs.
Oh, and CImage (I forgot to mention it in the list) - didn't like it's performance (though I have to admit that the idea of template-only implementation is cute, to say the least)
I strongly suggest you to write a little library around libpng and jpeglib (and every other low-level library for the formats you need to support). It is not that hard and you can code all the features you require.
As an alternative, you can use some of the good c++ wrappers that already exists for that libraries. Here are some examples:
png++
JPEGReader/JPEGWriter
Look at CImg library, it's just one single header file

minimal cross-platform gui lib? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a minimal and easy to learn C or C++ cross platform gui library.
In a nutshell I only need the following functionality:
application window
menu bar
some simple dialogs, File-open and save. Maybe a user-written one.
user canvas where I can draw lines an circles on.
some kind of message/event loop mechanism.
Target platforms would be Win32 and linux. MacOS would be nice to have but is not important at the moment.
Why am I looking for something minimal? I don't want to spend much time to learn a big and full blown abstraction system for a really small application. The easier and leaner, the better.
Any suggestions?
If you need something small, try FLTK libs: I used them at work (embedded development) and I think it's a valid option. Maybe apps are not as "cool" as QT-based ones, but developing with FLTK libs is fast and easy.
I don't know about minimal, but Qt is pretty easy to learn.
Its light-weight enough to run on embedded devices, so you be the judge.
EDIT after seeing the comments:
Yes, Qt is a fullblown application framework, but here's my case: an app with cross platform GUI but other platform-dependent code is not really platform independent. I don't think moving existing C++ code into Qt entails any work at all. If anything, this would allow Nils to use his existing C++ code, and only use Qt for a GUI. But of course, I assume that the existing C++ code is portable.
wxWidgets (formerly wxWindows) is a widget toolkit for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with minimal or no code changes. It covers systems such as Microsoft Windows, Mac OS X, Linux/Unix (X11, Motif, and GTK+), OpenVMS, OS/2 and AmigaOS. A version for embedded systems is under development.
http://www.wxwidgets.org/
See Good C++ GUI library for Windows for relevant answers.
Personally, I would go with Qt, now that it's open. You don't necessarily want a minimal library, you want one that is easy to use, and quality documentation and community support will give you just that.
Small projects have the nasty habit of sticking around and picking up scope -- as things get hairier, you don't want to be stuck with some small library that nobody knows about.

portable zip library for C/C++ (not an application) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I want to be able to zip files from my non-gui C/C++ application, on several versions of Windows, Linux/Unix, and MacOS.
The user will compile and run using this app using Eclipse + makefile or VisualStudio. I don't want the user to have to install something separately, or have my makefile install executables.
Prefer open-source. I'm already looking at "Zip 3.0"...
Take a look at Libarchive. I spent a lot of time seeking for a cross-platform and LGPL licensed library with convenient interface. This the best of all I've seen. Very easy and powerful tool. Originally designed for Unix-like systems but there's also the Windows version.
I've had great results with miniz: https://code.google.com/p/miniz/
For a simple compression of strings in c++, I also really like Timo Bingmann's solution.
I'd recommend ZipLib https://bitbucket.org/wbenny/ziplib/wiki/Home
Personal reasons why I love this project:
built around c++11 stl streams (ex. decompresses into stl streams!)
lightweight (no dependencies other than zlib)
can be used on both windows & liunx
It took me a long time to find this project - hope this helps someone.
We've used zlib a couple times here. It's a fairly standard library that has implementations in most main languages.
How about this:
http://zziplib.sourceforge.net/
http://www.info-zip.org/UnZip.html
HTH
Others have mentioned zlib, which is nice and fairly easy.
The 7-Zip (LZMA) SDK is more complex but also has very nice compression rates.
Edit: Although still in development, with the release process and history over time, I would be hesitant to recommend this now.
ZLIB - the most portable library in the world. open source, very proven and reliable. The gold standard.
why use anything else?