Can I code C++ application for Linux OS on Windows using Eclipse?
If it is possible, what are the settings I have to do in Eclipse?
Thanks in advance.
Can I code C++ application for Linux OS on Windows using Eclipse?
If it is possible, what are the settings I have to do in Eclipse?
Thanks in advance.
First off, find a compiler. I can't help with this one, but a websearch for "Windows to Linux Cross Compiler GCC" will probably help. So should browsing cygwin.
Good coverage here: C++ cross-compiler from Windows to Linux
That sends us to Eclipse to build a new project which I'm assuming you already know how to do. That gets you here:
which that leads here:
Nothing to see on that panel, so next to
Fill in the two text boxes and click finish. Path is kind of obvious, Where is Eclipse going to find the compiler and tools and the other is a bit weird. Because once you go down this path, you tend to have many compilers, they have to get different names to prevent confusion. So you might have linux-mips32-g++ and linux-i386-g++ and qnx-arm-g++ all on the same machine. Eclipse wants to know what to slap in front of g++ and the other tools.
There will be much more fun setting up remote debugging, but that's another question, I think.
C++ compilers are available for Linux as well as for Windows, so there is no such thing as "C++ application for Linux". Just write in standard C++, don't use platform-specific features (i.e. winapi calls) and don't use any libraries you can't build on Linux or any other target platform.
Given the above, you will just need to compile you program (which was initially written in Windows environment) on Linux, and it will run the same way. If you use latest language features (C++17 and/or expeirmental), you might get some compilation errors, which are very easy to fix. Something like #ifdef _WIN32
is your last resort when dealing with them.
Surely, you don't need any special settings. The only advice is to use a cross-platform build system. For example, CMake can do the lion's share of dirty work, while allowing you to write any platform-specific build settings in neat if(MSVC) ... endif()
blocks.