I am using X-Code 10 as a C IDE. I am doing a group project and we must use GitLab to share the code. To work in Xcode there are a lot of files to make Xcode work, but none that I need to share with my partners who are using their own IDE and who just need the .c files we are working on. How do I make Git not upload ALL files and just the .c?
There are ways to handle the excludes for a git project. There is the .gitignore file where you can create rules for what files should be excluded from your project. This file will be tracked by git, so you and your teammates will be sharing this file.
For your own personal excludes, you can put them into the .git/info/exclude file. This will not be tracked by git and will affect only your own local repository. This is a good place put rules that are specific to your own workflow.
Related
I have a project that has it's include files pretty much in the project folder...I don't use anything that's in, say, /usr/lib...It's all in ./whatever.
I'd like to share a project, with the intent that people will import it into Eclipse and then will be able to go from there. However, this never works right, because when I push changes, my environment variables get pushed too. This breaks other peoples projects when the pull from Git.
What do I need to exclude from revision tracking to make sure that the environment variables don't get changed with each remote push, but that things like new Include Paths do?
Thanks
From my experience, do not include
.project
.cproject
.settings/org.eclipse.cdt.codan.core.prefs <- CDT support stuff
.settings/org.eclipse.core.resources.prefs <- file encodings
.settings/org.eclipse.core.runtime.prefs <- line terminators
in .gitignore. This will reduce the fidelity of importing your project within your team. Files to consider including:
.buildpath <- system specifics
.settings/org.eclipse.cdt.core.prefs <- system specifics
I truly wish CDT was a bit more relocatable friendly (using 6.0 and 8.8).
Good luck
Randall
(Git platform maintainer for NonStop)
You need to add the unwanted files to your .gitignore file. For eclipse I believe your .gitignore must look like
.project
.buildpath
I have downloaded and installed some cn1lib files, like the BarScanner or DropBox libraries. I copied the files into the "lib" folder in NB and refreshed.
But now I wanted to try the Connectivity library and there is no "cn1lib" file. Only these 3 files:
I read on a blog post that we can create the files using NB, but there are no walkthru tutorials anywhere
Question
Can anyone explain how we should do it? (please don't skip steps. I am not a professional programmer)
The cn1lib file should be in the dist directory of the library project since its the result of building the library project.
So i have folders like this
c:\projects\generic\
c:\projects\project1\
c:\projects\project2\
Each folder under projects are their own separate local git repository. A project may use one or more header files from the generic folder. If a project uses a header file, it needs to be right in the project folder, not a subfolder under the project folder. Also, I probably wouldn't want the latest and greatest, I'd want to pull it by tag so I could be sure I have a specific version of the file in use for that project.
How would I do that? Is this something that could be done with submodules? Is there a better way to organize the folders in this situation?
I'd want [...] a specific version of the file in use for that project.
Yup: submodules are for exactly that. A submodule is a nested repository, the using projects' commits record (only) exactly which (other) commit SHA they need checked out at the submodule's path, git submodule just does the chores of getting the right submodule commits checked out when you want.
If a project uses a header file [from another repository], it needs to be right in the project folder, not a subfolder under the project folder [... I'm on windows].
It's lucky these are headers, otherwise there'd be a problem with that combination. As it is, the compiler can chase the relative pathnames with a #include "relative/path/to/submodule/header.h":
repo
|--generic.h: "#include generic1/generic.h"
|--generic1
|--generic.h: the real thing
lets say i have a qt project file (*.pro) and related files under a versioning system (git). The project is multiplatform and developing is performed on a lot of different ones as well. Developmers are both progrmmers and not programmers (matematicians, ecc) so i'd like to keep things as easier as possible for the person who cloned it (eg: avoid env variables).
The project is dependent on other projects whose are in an non-standard folder in the developer platform.
So i need them to edit the project file INCLUDEPATH += "absolute-path-to-external-stuff"
Problem is i'd like to put this single line in a file to be included in the .gitignore (remove it from versioning once uploaded) so that one can freely edit it without editing others when pushing to repo.
Should i use .pri files (and how? it seems they only are ok in subdirectories, cant find a reference) or is there a better pattern?
You can use a .pri file for that — a .pri is just a file that gets include()d by a .pro file.
Create a file in the project root called config.pri, containing the INCLUDEPATH addition
Add include(config.pri) to your main project file
Add the config.pri to your .gitignore
In the long run, you might consider using pkg-config to manage dependencies, since it integrates nicely with qmake.
I have a project which I try to compile with Eclipse-CDT. The project depends on a library with header files and source files. How can I configure the project in Eclipse such that it will compile the needed source files from the library with the project?
With a makefile I use:
SRC+=lib_source.c
You can add linked source file.
Choose project properties and in the left panel choose c++ general.
Under it choose path and symbols.
Now in the right panel tabs choose source location and add linked source folder.
Include you need to define in "include" (under c++ build you will find settings)
Another approach is to use the operating system to add your libraries to the project. Eclipse then treats all source files (including library files) as part of the project, and therefore compiles any that need it even if they are in the libraries. This set-up allows keeping the library sources in a separate git repository from the project source code. You can record the git commit of a library to provide library version control so that improving the library in one project does not break all the others. The setup relies on the operating system's capability to link directories in a way that is entirely transparent to eclipse--in windows using the mklink command.
In windows the steps are
put your library files in a clean workspace not mixed with .git (you can have .git in the parent directory as egit sets it up)
use cmd window in administrator mode to add a link from your project directory to your library directory.
from eclipse press F5 t make sure your project matches what is on disk, then set up git to ignore your library directory.
set up your library file properties for read only access unless you are still tweaking that library.
set up your project include path to include the project sub-directory in your project.
I can't remember why I abandoned eclipse linked directories; i think it was that the includes kept breaking. The mklink approach has worked flawlessly so far.
I have a pdf tutorial of how to set this up--but I'm new to the forum and don't see how to attach a file.