I have around of 4 years experience in C#.Net programming and i am developing a client server application. The server application will be insalled on CentOS and client application will be installed in Windows OS. But, i don't have much knowledge about c++ programming on linux platform. So, my question is that can i create a console application in Windows OS and compile it for linux platform. it is not necessary that compile it on Windows. but, it should be executed in linux platform. I am new in linux programming.
Presently i am using TC++ editor. Can i use Visual Studio 2010 to build server application for linux platform?
if there are another approach then please suggest me.
Thanks.
You can develop the client in C# and the server in C++, if you prefer. Consider that unlike C#, there is no standard socket library yet, and you'll have to rely on either system calls or their higher level wrappers (like boost).
I've to tell you that Windows uses BSD sockets (its own version, with some modifications though), therefore with a few preprocessors checks, you can make your application portable.
In your case, I'd suggest you to go for boost.asio which will hide all low-level stuff for you. It's even cross-platform.
Maybe you can use VS as an editor ; Make sure that you do not include any windows specific libs; There is an option of using cygwin and doing a cross compilation. Check the links
How to cross compile from windows g++ cygwin to get linux executable file
I guess it will be more of a pain. Better use Virtual Box --> linuxMint/Ubuntu + Eclipse with C++ plugin or some other C++ editor...
Related
I have fallen in love with the capabilities of Rheolef, a C++ library for Finite Element Analysis that is available for Linux only. I am developing an application in Windows and was wondering if I can build Rheolef for Windows and use it in my application.
I read a few posts about Cygwin but my understanding is that it only mimics the Linux environment in a Windows settings. Also, I found a technique that can compile a single source code for Windows.
Is there any tool or method that could make the entire Rheolef library for Windows from Linux?
I've got new task to research the way of development C++ cross platform (Mac/Win) utility for our internal needs.
I've developed for 7 years using different "pink" languages like C# , Java , Managed C++.
But in this task , the requirement is to support Mac , and .NET that is running on Mac , is really pain (Know this from other guys who did used this).
So I've started to think about C++ if it's possible to use C++ for Cross platform development.
The application will no contain any GUI , but will contain a lot of System API calls , and a lot of business logic analysis.
Is there possible some library allowing to achieve such kind of Task ?
Is it possible to do at all ?
Yes, you can write standard, ISO C++ and run the programs on both platforms.
When you need to implement some functionality using platform specific APIs (e.g. using Win32 on Windows and POSIX APIs on Mac OS) then what you do is write your own wrapper functions that abstract away the platform specific details, and then use that wrapper in the rest of your program.
Tools like CMake will allow you use Visual Studio to build the program on Windows and Xcode to build on the Mac without having to manually manage separate Visual Studio and Xcode project files.
If I understand your question properly, the only thing you need to develop cross platform c++ is to get the right compilers. You could use GCC on both platforms or even use 2 different project files for visual studio and xcode. That's up to you. Personally, I prefer GCC.
Regarding code itself, it depends on what you do with it. STD is available on both platforms (std::vector, std::string, etc) so code should compile properly on both platforms.
Edit: Btw, most platform specific stuff are available through open source code (like boost though I personally don't like boost that much). If needed, you could even look at other open source projects that are cross platform (ogre3d, etc).
I would like to develop C++ on Windows because I prefer the Visual Studio IDE (eclipse on Linux isn't very nice). However, eventually I will migrate to Linux and some of the code I will be writing will use low-level OS system calls.
Is there any way I can install a Linux emulator (not sure what you call it) on Windows, write Linux system calls in Visual Studio 2012 and have these system calls target the emulator, rather than the Windows OS?
I have tagged VS2010 but I can use VS2012 also.
Windows OS is Win 7.
You've already tagged your question with Cygwin. That seems like the best solution for what you want. Cygwin is basically a collection of programs which emulate a GNU/LInux environment through the use of a
DLL (cygwin1.dll) which acts as a Linux API layer providing
substantial Linux API functionality.
Here's the link to the documentation for its API
Edit: Most of the Cygwin source code that I've looked at is written in C++ and makes system calls using MS Windows API to do provide the *nix emulation. The source is well written and very readable (even to to a non-C++ programmer such as myself). I think using Cygwin would be a good transition from programming on Windows to a GNU/Linux environment.
My team is planning to start development on linux platform. Previously we have been developing C++ applications in Windows using MS Visual Studio. And recently, I fell in love with Mac OSX and use it as my personal development machine.
The question is once again: Is it possible to use Xcode for Linux Development?
The applications we are building are real-time applications, which do not require fancy looking GUIs or advanced user interaction, the focus is on the performance.
As long as you stick to cross-platform interfaces (glibc, POSIX, STL, etc.), sure. You might need a Linux machine to actually build the binaries for Linux though.
I think it is possible since both xcode and linux are using gcc and could use similar development toolkits, and both osx and linux are unix based, therefore you can debug and code on osx, but I think you still need to recompile your apps on deployment O/S ( so make sure you're using portable codes between osx and linux)
How could I write a program which runs on both Windows 7, Mac OS X (and maybe linux too)?
I heard Qt are a great framework to build cross-platform GUIs, but I think every program version need a recompile, isn't that right? And should I compile the win version under windows, the mac version under mac os x, the linux version under linux and so on?
I'm getting ideas and/or suggestions
The underlying binary format is different on each platform, so unless you're using a virtual machine (like Java or Flash does) you will have to recompile your program on each platform.
Some compilers (like GCC) allow cross-compiling, but it is not trivial to set up. Probably the easiest system to cross-compile on is Linux (there are several open source projects that have cross compilation set up from Linux to Windows).
In case of a GUI application, it depends on the language -- if you're stuck with C++, Qt or wxWindows might be a reasonable choice providing an abstraction layer over the native windowing system.
If you can go with Java, it makes life simpler, however the windowing system is Java's and not native.
Another language to think about is FreePascal w/ Lazarus -- it has a pretty good GUI designer that compiles to the native windowing system on every platform (WinAPI on Windows, Cocoa on OSX and GTK on Linux).
Not sure if C++ is a must, but Adobe Air is a great cross platform development environment for desktop, and its growing for mobile development as well. If you need an example of a major application using Adobe Air to deploy to multiple desktop OSes, just check out tweetdeck http://www.tweetdeck.com/
I'd highly suggest also looking into Flex and Flash Builder if you go that route.
There are two separate issues I would highlight when writing cross-platform programs -- how to make your code portable, and how to arrange for it to be built on the various different platforms.
As far as the building side of things goes, I would look into a cross-platform build system like CMake (http://www.cmake.org). You essentially write a script and CMake will generate the appropriate project file/makefile for a specific platform. You then build your program on each platform as you would normally. For example, on Windows, you might use CMake to generate a Visual C++ project for you, and then use Visual C++ to actually build your executable. On Linux, you might use CMake to generate a makefile, and then build the executable using g++.
The other aspect is how to make your code portable -- the key is to write C++ standard-compliant code and make use of libraries that are themselves portable across the platforms you're interested in. You can (and may sometimes need to) write platform-specific code for each of the different platforms -- if you do, you should hide it behind a portable interface and have the rest of the code use that.
Yes, you need to compile for each version when using C++.
The only thing that prevents you from compiling a program, for example, for Windows on Mac is to get a tool for doing that. It is possible, but the problem is finding the toolset.
Also you can use a virtual machine for running diferent OSs and compiling code for all platforms on the same machine.
Java runs on Windows, OS X and Linux