Where should self-created headers reside in Eclipse-cdt? - include

Below is a picture I grabbed off google, and it is actually linked back to a previous Stackoverflow question.
So, on the left (project explorer view) we see an Includes and src directory. I believe the Includes really is just paths to where header files may reside in the file system.
So now for my question, should header files I have made say "xyz.h" reside in the src folder in an Eclipse project?
Currently I put them somewhere in the file system on my Linux machine and then path to them (so they show up in the "Includes" for the project), this allows me to edit them in the eclipse editor and so forth, but I believe they are not actually a part of the "Eclipse project".
Not sure there is a right and wrong answer, just looking for what others few as the "best" way.

Generally the header files that you create should be in your project.
The main purpose of the "Includes" mechanism is finding the headers of third-party libraries that your project may use.
You can also use it to specify the location of includes inside your project. For example, you might have an include folder inside your project, put all (or some) of your headers there, and configure that as an include path. Eclipse allows you to configure include paths relative to the project, by choosing "Project Path" when adding the include in the project's Paths and Symbols preference page.
As your projects get large, you may eventually want to split them up into several projects, such as an application and supporting libraries. In a case like that, the application's project would have include paths pointing to the headers in the library projects.

Related

How can I avoid publishing the library folder in a Web Publish?

I have moved binary files into the project under the bin folder to avoid publishing the same binary files twice since one of the binaries is huge; i.e. 15MB.
This was originally in a separate Includes folder. So the files were being copied twice to the publish folder.
Is the bin folder the correct placement for these or are there other steps I should take?
Edit:
Sorry if I gave a poor explanation (and original title). I've changed the title; this was "Where should static libraries (3rd party DLLs) be kept in Visual Studio?", and is now, "How can I avoid publishing the library folder in a Web Publish?"
As mentioned, I originally had a separate folder named Includes. When I did a Web Publish, each of the DLLs are published twice; one into the bin folder, the other into the Includes folder. In this case, I am publishing at least an extra 15MB of unnecessary file space. Normally, not a big deal but if I am on a very slow connection, I'll need to wait longer to deploy the project to its environment.
I moved the DLLs back into a separate folder but the folder is still published along with the bin output folder. I did this to see if the placement of these files would set their properties differently.
I have tried various settings for Build Action and other property settings for these libraries without success.
Is there no way around publishing the DLLs twice?
If these files are part of the overall source of the system (not necessarily as source code, but as source-control-tracked artifacts nonetheless), then you probably don't want to keep them in the output folder for the build. The output folder should be transient and shouldn't be tracked in source control.
Keep 3rd party libraries in a library folder. The folder structure in source control might look something like this:
/
--/lib
--/Project1
----/SomeSubFolder
--/Project2
----/Images
----/Styles
and so on.
Each Project would have its own bin folder when it gets compiled, which itself may contain other folders for types of compilation (Release, Debug, etc.). But you don't want those build artifacts tracked in source control or in any way interfering with what's in source control.
The projects would reference their library dependencies, and at build time those dependencies would be copied to the output folder to be used by the application runtime.

Limit Refactoring Scope in Webstorm

Is there a way to configure Webstorm so that when it refactors, it ignores specific areas of my project. Specifically, I would like to be able to ignore folders containing 3rd party dependencies and built assets, such as node_modules.
You can make a JavaScript library of these folders as described here. They will be excluded from renaming and other refactorings scope.
You can also mark directories as completely ignored - they will then not show up in Webstorm's project view, will not be included in searches, won't be scanned when refactoring, etc. This is typically useful for directories containing built assets.
Right click on the folder in the project view, and choose "Mark Directory As", then select "Ignored".

Add a reference to a static folder from visual studio (2010 or 11)

I'd like to include some folders of static files shared between many projects and solutions.
These files could be images, script libraries or css that are shared between many projects.
I do not want to copy each time the folder inside the project structure but reference it just as we can link files between projects in the same solution so if any file changes in the referenced folder all the projects that link to it will have an updated version.
I know I can put it in a shared dll and embed resouces in it but I'd like to be able to choose witch folder to include.
Is this possible with Vs2010 or Vs11?
Sure, its possible, and not even that hard. Put the files in a well-known location in your hard drive, then add them to each project as a link. See the second section in the following article:
http://msdn.microsoft.com/en-us/library/9f4t9t92.aspx
If you use source control, I would strongly encourage you to have at least one separate folder per solution file, and nest the folder under your solution root somewhere. TFS, in particular, gets antsy if your solution file includes locations that are outside the current workspace. (It will work but you may get strange warnings or errors, particularly if someone else tries to get the solution for the first time.)

When to tick "copy items into destination's group folder (if needed)"

Whenever I am adding some files to my project by dragging and dropping in Xcode, a popup message is shown "Copy items into destination's group folder (if needed)".
I noticed that when we are using most of the third party library's we DON'T tick the checkbox and instead specify the library path in "Header Search Path/Library search Path". But for smaller resource files like images, we tick the checkbox.
Which specific scenarios do I have to tick and what difference will it make?
It all depends on how you want to organize you project. It's far more common to store 3rd party frameworks somewhere on your machine that is independent of any project that may use that framework, thus allowing multiple projects to reference the same shared framework project from a standard directory. In that case, you don't want the 3rd party framework copied into your own project, and so you don't check that box.
Images and other resource files are typically owned on a project-by-project basis, so it makes the most sense to store those in the directory of the project itself. To pull that off, you check that box to make sure a copy is made in the project's directory if one doesn't already exist.
Neither of those rules are absolute, you could copy an entire framework into your project's directory if you want, and you could reference media assets from some standard location. It's all up to you to implement good project organization.
Typically, your project is saved to a project folder. If you drag stuff from outside the folder into your project without copying, only references to the added files are stored. You will have to be careful not to delete them, or your project will break.
Also, if you are using version control, such as the built-in git, files not in the main folder will not get added to your version tree.
I got into the habit of copying everything I need into the main folder and then drag-add without copying. This is working well for me and has so far avoided any errors.

What is "Source Tree" in the Xcode preferences and what can I do with it?

I've been recently researching how I can manage source files in a project or multiple projects. I've read that Xcode has a built-in support for using svn, and will support git as well, both of which I found to be very useful.
The one thing I couldn't understand clearly is about Source Trees described in Xcode Project Management Guide. Here is my theory, but as I couldn't really verify this from anywhere (as far as I could tell), I would really like if someone could say what I'm missing, if any.
A Source Tree in Xcode preferences is more like a root of a source tree, which is a folder in my local file system.
I can use any files in any of my Xcode projects, even if the files are not in the project folders, if I can specify the files' location related to one of my source trees.
Now someone has the same project folder that is synchronized with mine. She has all files in the project folder, but the files referenced by a relative location to the source tree may exist out of the project folder.
But she has a source tree, with the same Setting Name to mine, (but absolutely in a different folder in her local file system), and if she has the file in the same relative location, then her Xcode can access the file without a problem.
So is this correct, and we use source trees because it enables us collaborating with files outside the project folder?
And even if the files outside the project folder is referenced by a relative path to the project folder itself (not to a source tree), if these files are all managed by SVN so they exist in the same relative location to the project folder in everyone's environments, then I wouldn't need source trees, right?
I never think I am an expert of Xcode, but it seems your question hasn't been answered for a while, so maybe it's worth commenting what I could say:
What you described is pretty much about it. Think is as an environmental variable of an operating system. Typically in a build system made by Autotools, for example, files are referenced by relative paths, such as $PROJECT_HOME/src/common/error.cpp. It doesn't matter where $PROJECT_HOME is in each user's local file system, as long as files are accessible by their relative paths to the user's $PROJECT_HOME directory.
And yes, you don't need to use source tree if the entire folder hierarchy used for a project is referenced by relative paths to the project home and somehow it is certain that everyone has the same files in the same location (for example, because a version control repository contains every files in a chunk as you said).
However, I think it's the best to keep all files in the project home folder, unless they are used across multiple projects, and therefore your version control repository only contains a single root directory (the project home) for your project. If there are files that are best to be shared by multiple projects, then I would have a separate repository for those files. In this case all of your coworkers must use the same protocol, say, having a source tree with the same setting name and put all project homes retrieved from your version control server directly under the source tree (so files outside a project home can be referenced in relation to the source tree for all programmers).
The most of my answer is kind of rephrasing what you already described, but that's how I use the source trees feature in Xcode myself. Maybe others can tell you more about it.

Resources