Is there a way to exclude certain directories from ignore-glob such that (e.g.) .dll files will generally be ignore except if they are in some specific directories?
I'm afraid you would have to specify all directories you don't want to see .dll files in, and make sure the directories containing wanted DLLs don't match any of the existing ignore-glob entries...
May I ask, what is your use case?
Related
I'm trying to load image with IMG_Load() function from SDL.
I saw from tutorials that they doesn't need full path for asset files.
But when I try to do that, it doesn't work.
My solution is include full path of those files, but I found that is clunky. Especially when I try to collaborate with my friend, it's hard to synchronize source files since we use different file paths.
May I ask what is typical way to collaborate between programmers when they have different setup, different file paths? I think that I need to simplify the file path for asset.
I tried to add include directories for compiler, but it only work with header files, not for asset files.
Relative paths are relative to the current working directory. On Windows, when starting a program from the exporer with a double-click, it matches the location of the .exe, but this isn't always the case, e.g. when running from some IDEs.
Use SDL_GetBasePath() to get the directory where the .exe is located. Prepend it to your asset paths.
When cloning a repo on github I have made with lots of subfolders (like src,include and then several sub-directories in those) on a new PC I get a heap of errors that it can't find the paths for the include files. How do I quickly let Visual Studios know to look for include files in those sub-directories and not just the main folder where I cloned the repo?
Going into properties and choosing "include directories" I can manually select paths to look for include files, but I obviously don't want to manually add the dozens of sub-folders where include files can be found. Preferably I would like whoever is cloning the repo to not have to worry about this at all of course if there is something to do about this when creating the repo. Thank you!
The github repo for reference: https://github.com/OscarUngsgard/Cpp-Monte-Carlo-Value-at-Risk-Engine
And a picture of the "include directories" options I'm refering to in visual studios:
As far as I know there's no way to search for include files in subfolders. And it's obvious if this was possible it would not be relevant to do that as this will take more time to search them.
But you can do one thing, when including files just add their relative path
Such as
#include "../src/header_file.h"
So, we have all seen (some of you guys might have even made) professional libraries which have proper include directories which contain all the header files you need to use the library. An example would be the OpenCV library include folder which I have attached.
When we release libraries, what we do is just zip the headers for the lib and ask the recipient to extract them to somewhere convenient, which is, to be honest, quite fine. However, I would like to make an 'include' directory with all relevant headers if possible because I feel that my distribution can be organized better that way. How can we go about doing that?
You can just create a folder for all neccessary headers and specify path considering that folder when include them in code.
You can also specify that folder in preferences of your project, for example Visual Studio or Eclipse allow it, so you shouldn't write full path for those includes.
I have multiple solutions for different project I have worked on but the project I am currently working on rely on a class from a previous solution. I was wondering if there was an easy way to link these solutions together so I have access to all the previous classes.
The most maintainable way to do this is to add the source project's header file directory to your target project's include list.
In the project's configuration properties page, go to:
C/C++ -> General -> Additional Include Directories.
If the source project is compiled into a library, dynamic or otherwise, you will need to link with the corresponding .lib file.
To do this, go to "VC++ Directories" and add to the "Library Directories" field the path containing the .lib file.
Note that you can also add your source project's header directory in this page as well.
After that, go to Linker->Input and add your library's .lib file name.
You will now be able to #include<your_header_file.h>.
Note that you will need to be careful about the choice of directory, as files with the same names as standard or platform-specific headers will cause problems.
EDIT:
I do not know of a way to avoid editing the VC++ Directories page in the project's property page to add a library directory. Why is this a problem? Things like Intel's C++ composer like to step all over these fields (you have to let it make a mess, then you can clean it up).
I have had C++ experience but not MSVC.
What I am trying to do is incorporate a .dll from an open source project into my project. The code is available and I have built it. I have the .dll as well as the .lib which as I understand it is required for C++ projects.
Now unfortunately there is no simple "Add Reference", drop my .dll into an include directory and add that to my solution. I have edited the project property pages, the C/C++ Additional Include Directories option as well as adding the .lib as an additional linker dependency. I have created an include directory for the dll and lib inside my solution tree.
My problem is when I try to include the header files from the documentation, VS output spits out error messages. Now I realize that I am using the dll/lib combo and that the .h files are not present in my solution so how do I add the proper includes? I am using QT toolkit also which is working but how I add the other header / dll from the open source library eludes me.
Can someone please point me in the right direction.
You need to do a couple of things to use the library:
Make sure that you have both the *.lib and the *.dll from the library you want to use. If you don't have the *.lib, skip #2
Put a reference to the *.lib in the project. Right click the project name in the Solution Explorer and then select Configuration Properties->Linker->Input and put the name of the lib in the Additional Dependencies property.
You have to make sure that VS can find the lib you just added so you have to go to the Tools menu and select Options... Then under Projects and Solutions select VC++ Directories,edit Library Directory option. From within here you can set the directory that contains your new lib by selecting the 'Library Files' in the 'Show Directories For:' drop down box. Just add the path to your lib file in the list of directories. If you dont have a lib you can omit this, but while your here you will also need to set the directory which contains your header files as well under the 'Include Files'. Do it the same way you added the lib.
After doing this you should be good to go and can use your library. If you dont have a lib file you can still use the dll by importing it yourself. During your applications startup you can explicitly load the dll by calling LoadLibrary (see: http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx for more info)
Cheers!
EDIT
Remember to use #include < Foo.h > as opposed to #include "foo.h". The former searches the include path. The latter uses the local project files.
The additional include directories are relative to the project dir. This is normally the dir where your project file, *.vcproj, is located. I guess that in your case you have to add just "include" to your include and library directories.
If you want to be sure what your project dir is, you can check the value of the $(ProjectDir) macro. To do that go to "C/C++ -> Additional Include Directories", press the "..." button and in the pop-up dialog press "Macros>>".
You mention adding the additional include directory (C/C++|General) and additional lib dependency (Linker|Input), but have you also added the additional library directory (Linker|General)?
Including a sample error message might also help people answer the question since it's not even clear if the error is during compilation or linking.