Hello I am making a game for both computer and android devices and i was wondering if there was a way to link the two projects so that i would type the code once and have it saved to both projects because copying and pasting is such a hastle...

P.S. The code for both is almost completly identical.

有帮助吗?

解决方案

The simplest method is to simply import source code into each project.

So, let's say I have source code at C:/dev/c/game

You have several import options.

  1. Do a File->Import->C/C++ and select Existing code as a makefile project. Then browse to the source folder. Repeat similar steps for Android, java, etc projects.

  2. Link source files in your project with existing files.

    • So, create a project as normal, then File->New->Source Folder. Then browse to your existing source.
    • Or you can right click the project, New->File (or Folder), give it a name (specific to the current project), click Advanced and check link to file system (then browse to the actual file or folder)

All of these should easily enable cross platform sharing of source code where edits in one will be immediately reflected in the other project.

If you use version control, it's even easier. You can checkout the same source file into different projects (or nest the same independently version controlled source file into different version controlled projects).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top