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.

- 6,818
- 11
- 39
- 70
-
you can install cygwin in windows, and compile the application in cygwin. The code should be fine to run in linxu (most case) – BMW Feb 14 '14 at 04:24
-
No, it will not! Most compilers available under Cygwin will create Windows executables (that you can run under Cygwin), NOT Linux executables. – Feb 14 '14 at 04:26
-
I have used Mono compiler before. but, it creates windows executable and it can run under MONO console only. I think Cygwin and MONO are same. I have also read this answer related to cygwin. http://stackoverflow.com/a/4144536/3184380 – Shell Feb 14 '14 at 04:42
-
if i cannot compile c++ application in windows for linux excutable. So, can i move that classes into linux os then compile it? – Shell Feb 14 '14 at 05:20
2 Answers
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...

- 1
- 1

- 5,287
- 3
- 59
- 71
-
Thanks Alex. now i am installing cygwin. but, there are lot off packages are included in the package selection list. How do i know what are the packages i required. – Shell Feb 14 '14 at 04:51
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.

- 8,220
- 2
- 26
- 45