Setting default additional include/library paths in a Visual Studio C++ project - c++

Maybe I just did not really search for the right keywords yet, but I couldn't find a decent post about this.
The thing I want is that everytime I create a new c++ project, it should automatically add additional include and library paths into the project. Is there something like a default configuration manager or something similar? It really gets annoying to always add the same include paths and library paths into all the projects.
Thanks in advance for any help!

You can choose the empty project option when creating your project, so you don't include unnecessary library paths. I hope I can help you!

Related

Setting up C++ include settings for a large library such as Paraview and QT in Eclipse

I have an application where I am compiling against the libraries Qt (5.11) and Paraview (5.6). I am developing in C++ and I am also coding in Eclipse.
Yes, I am aware that Paraview is more of an application then a library. However, I will be using it as a library to intergrate Paraview in my application in order to visualize some data. I could use QT creator and that would take care of the QT library. However, I am not very familiar with QT creator as an IDE and my entire workflow has been based around eclipse. For this, I would like to utilize components that I am familiar with.
Now, as many of you know, the QT library is large, very large. So is Paraview. I could create a search path for each folder containing the header files I need in the C++ include settings. If I go in this direction, then my library search path will be long, very long. Also, there might be a situation where I need to change computers (for whatever reason), I would then need to edit the search paths for the new computer and that will take time.I had thought that I could only include the paths to the include files that I needed. And I have started to do that. However, when I compile my application, I noticed that the libraries would use include files that are located in a directory that Eclipse is not even searching in. At the end of the day, I would need to include all of the directories to which the header files are stored in.
I was wondering if there might be a better method to reference all of the files that my project needs? Both come with make files (I believe that Qt includes a QMake file?). Is there a simpler method to include all of the files instead of editing the C++ include path for eclipse? I did see an option for QMake in Eclipse, is there anything that I can do with that feature to compile to QT library with my application?
Thank you and any feedback is appreciated. Also, feel free to suggest edits or clarification so that my description is clear.
Note some good practices when working with eclipse and qt or other large library.
Include the directories with a headers
If you use option "Generate Makefile automatically", add group include path with GUI Eclipse:
copy the directories with a headers (via system explorer);
go to project properties/C/C++Build/Settings/Tool Settings/GCC C++
Compiler/Includes.
paste directories (Ctrl+V) into "Include paths" list.
If you are using a qt-eclipse-integration plugin, you can add folders via the Discovered scanner configuration. You can find it if open: project properties/C/C++ Include Paths and Symbols/Add Contributed...
Create new project
if you already have a customized project, you can use it as a template:
make a copy of the customized project and name "mytempate";
delete all files from "mytempate".
When you want to create a new project, copy the template and specify (in the copy dialog) the path where the source codes are located.
Now you have a finished new project with settings and code.
Change computers
Use one of the ways:
1. Export C/C++ project settings for use in another workspace via project properties/C/C++ General/Paths and symbols/Includes/Export Settings...
2. Pack in the archive eclipse and workspace and copy your another computer.

Eclipse Neon will not add include path

I have two projects in an eclipse workspace and one will add the include path for the boost libraries and one will not.
both projects use -std=c++11 I have included the include path in the c++ settings for both projects and it will not show up in the Includes section of one of the project. I have no idea where to look to resolve this issue.
I can include other include paths and they work as one would expect. I think it must have something to do with the boost libraries but I have no idea what to look for.
Any suggestions would be appreciated.
I just created a new project and copied all of the files over and it works perfectly, it must have been some problem with the project. Sorry for the bother.

Visual Studio: C++ Project Include Paths sharing over Repository

I was wondering how should I add my library include paths and linker paths in Visual Studio so that when I add my project to a repository, another developer checking out my project would not need to go through all the include paths and change them for his own machine. So, I am kind of looking at something like ${MY_THIRD_PARTY_LIB_INCLUDE_PATH}\tbb\include and ${MY_THIRD_PARTY_LIB_LINKER_PATH}\tbb\lib\ia32\vc11 so that someone accessing the project can just change MY_THIRD_PARTY_LIB_INCLUDE_PATH and MY_THIRD_PARTY_LIB_LINKER_PATH and everything works as intended. Can somebody suggest a best practice around this or may be how to accomplish what I just described?
In VisualStudio 2012 I use Project Properties
So if you go to the Propery Manager you Add a new Project Property Sheet to you project. From there, a couple of things can be set
User Macros - We create a macro here and put in a path for our environment. We crate a Macro called CUSTOM_DEBUG_PATHS, and then in the project we set the Debugging->Environment to path=$(PLA_DEBUG_PATHS);$(PATH)
The other thing that we do in the Project Property Sheet is change our Include and Library directories. We have everyone use relative paths, but you could put in an environment variable or something in here so that everyone could use the same file.

Visual c++ 2008 express creating a library

I know many have asked this question, but following the things suggested hasn't seemed to work for me. So I thought I'd ask for help, as I'm obviously missing something.
I've spent the past couple days writing some code that uses the boost library that allows me to open text files, translate the text into a usable data format, and save the data as a text file when I'm done with it. I built it specifically to be extendable to deal with different datatypes (specifically any object or class I make down the line) so that I could link to it as a library in my project as I do other libraries.
However, even after compiling it into a lib and adding the directory of the lib to the "Additional Include Directories", I get an unresolved external error whenever I try to include one of the header files in the library. I've also tried putting the direct path to it under Additional Dependencies (as well as just the library name with the path to the directory set in Additional Include Directories and Additional Library Directories. I also tried it with only one of those on at a time and it still failed).
Is there something I'm missing? How can I compile this code I'd like to reuse and link to it in new projects without copying the cpp and h files into my solution every time? Would a DLL work better/easier? If so, how would I go about compiling it as a dll and linking to it?
Thanks for reading this wall of text. Any help you could provide would be great.
Ok. While it's not the exact solution I was going for, I managed to figure this out. For anyone running into this problem, there's a wonderful tutorial that explains how to make DLL files and make use of them (at least on windows, don't have any computers using an alternate OS set up yet to test the DLL on). You can find it here.
http://programmingexamples.wikidot.com/blog:1
The gist of the problem is you need to also keep a copy of the .h file handy to include in your project. (what I did is created a directory on my C drive that holds the libraries I'm making, and in that I have a folder for the .lib files and a folder for the .h files.) Either import the .h file directly into your project directory or add it to your project properties (C++ -> General -> Additional Include Directories ). Make sure for that, you're linking to the directory, not the file itself. In the linker, you need to add your .lib file to the Additional Dependencies section (Linker -> Input -> Additional Dependencies). You can put the whole path here, or you can just put the file name, then tell the program where to find the directory it's in (add the path to the directory to Linker -> General -> Additional Library Directories)
Hope this helps anyone else who managed to miss something that everyone else seems to understand instinctually :P

Include C++ library source in Netbeans project?

Is there a "good" way to directly include a library's source in a Netbeans project?
When I try to do it, I add the include directory in the Linker options and src in the source directories but I get a ton of "undefined reference" errors unless I add the folder into the project using right click>add existing items from folder.
Is there a better way to do this without having all the the code in the project ?
Thanks a lot in advance for your answers
Try doing this:
Select Tools->Libraries from the menu, create a new library there, then on right side click "add Jar/folder" to insert your folder.