A good approach to develop a Linux application on Windows.
Wayne's Site
I love GitHub
Beijing, CN
Overview
Sometimes for convenient reasons, user custom or other reasons, I’m always looking for an approach to develop Linux applications on Windows environment, until now I got a good way for this.
On Windows
Create a normal project on Windows with eclipse CDT.
Create CMakeList.txt to the project.
Create .gitignore file which ignores those files only work on Windows or Linux.
Commit project to git repository.
Convert project to Executable Cygwin GCC project on Windows.
Developing, push to git when done.
On Linux
Clone the project from Linux.
Add project to eclipse CDT on Linux.
Convert project to Executable Cross GCC project on Linux.
Pull updates from git before test on Linux.
Inside docker
Clone the project from any version inside docker containers.
Build application from older version of Linux.
On Windows Side
Create a normal project with CMakelist.txt and .gitignore,
commit the project to git repository.(github or gitlab)
Create a normal project
In Eclipse CDT
File -> New -> Project… -> General -> Project
add CMakeList.txt and .gitignore
Commit to git repository.
Convert to Excutable project
Right click project -> New -> Convert to a C/C++ Project Excutable -> Cygwin GCC -> Finish Developing … -> Build … -> Run
Clone repository, convert project to Linux Excutable type.
Clone repository
Clone project from git repository.
Import project
In Eclipse CDT
File -> Import… -> General -> Existing project into Workspace
Convert to Excutable project
Right click project -> New -> Convert to a C/C++ Project Excutable -> Cross GCC -> Finish git pull … -> Build … -> Run
Inside docker
Sometime we have to build application on an older platform to avoid newer library reference which cannot be found on old platform.
and we may not find an old platform easily, it’s good to use docker for it.
Find an image in docker
You can find a specific version of CentOs on docker, for example we need CentOs 6
Download CentOs 6
Rename an image
The names of images downloaded from repository are various, we need give an name which is easy to understand, we can rename the images.
Run an image
other docker commands
run project in docker
Clone project from git repository
Make sure cmake is installed
Build and Run project
Leave a Comment