如何将源文件导入到我的项目中,Smartsn吗ippets

6 posts / 0 new
Last post
jamesleo-konka
Offline
Last seen:4 years 1 month ago
Joined:2017-01-22 02:42
如何将源文件导入到我的项目中,Smartsn吗ippets

Hi, Dialog
I make new c and h files, but failed to import to my project.
For peripheral_demo project, I copy my c and h file to 'demo' directory, but it doesn't appear in project view.
So I tried to import them, there is a item in Import -- General\File system , and then select the 'demo' folder , the IDE told they have been in the project ....

How to import my c and h file into project?

Best Regards

James

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi jamesleo-konka,

Hi jamesleo-konka,

Dont copy the files that you would like to import to the project folder in the SDK, the eclipse is going to do that for you, so in order to add .c or .h file into your project you can:

  • Select Import -> file system point to the folder that contains the files that you would like to import and select them.
  • You can just Drag and Drop your files.
  • You can just copy paste your files.

If you just want to place your file in the directory and make them appear in the eclipse project tree, just left click on the project and hit the refresh option or click onto your project and hit F5.

Thanks MT_dialog

jamesleo-konka
Offline
Last seen:4 years 1 month ago
Joined:2017-01-22 02:42
Hi, MT_Dialog,

Hi, MT_Dialog,
It's easy to copy/paste from one project to another.
But for the Includes of a project, there is no copy/paste operation to do. How to 'copy' the includes settings from one project to another?

Thanks

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi jamesleo-konka,

Hi jamesleo-konka,

I am not sure i get the questions, you are able to copy include files as well from one project to the other, and then you can add those file in your include path via the C/C++ Build -> Tool Settings option. You can also have a look at the eclipse documentation for those kind of procedures.

Thanks MT_dialog

jamesleo-konka
Offline
Last seen:4 years 1 month ago
Joined:2017-01-22 02:42
Hi MT_Dialog,

Hi MT_Dialog,
I know the way to copy whole project to a new one, and then rename the key file's name and key words in .cproject file.
I think it's easy to add c and h file by copy/paste them in the project window, no need to rename something.

For the Includes, I tried the another entrance : C/C++ General -> Paths and Symboles and the C/C++ Build -> Tool Settings you mentioned, but I can only specify an absolute file, not the relative file like: /${ProjName}/sdk/adapters/include. How to add a relative path ?

Thanks

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi jamesleo-konka,

Hi jamesleo-konka,

I am sorry, i am not sure i get this, if you go into the Properties -> C/C++ Bulild -> Settings in the tool setting tab and the Cross ARM C Compiler at the Includes section all the header files that are included in the build process have the following path, "${workspace_loc:/${ProjName}/xxx/xxxxx/xxxx}".

If you try to add a header file and you hit the workspace the entry of the file that you will specify will have a directory like the one mentioned above.

Thanks MT_dialog