regarding using of Property sheets VS 2008 c++ - c++

I am trying to run a project in c++ using visual studio 2008... in vc++ . Now I have a sample project which takes care of the additional included libraries and some other settings... I want to import these settings into my new project. I tried to save the settings of sample project and include them in mine. But I can't see those properties in my new project.
for eg. sample project displays the linker->input->additional dependencies as cv210d.lib cvaux210d.lib highgui210d.lib cxcore210d.lib cvblobslib.lib but the same thing in my new project shows blank...
CAn you please give me the steps for linking properties??
What I did was save the property page and then added existing property page in my new project.. That doesn't help

This is maybe not exactly what you wanted, but you can fix this problem by just copying the stuff you want (cv210d.lib cvaux210d.lib highgui210d.lib cxcore210d.lib cvblobslib.lib) into the blank space in your project. It's editable, you know what should be there, so just go ahead and put it there.
I guess this will only solve one problem (link dependencies) and you want to solve all such problems by importing. How to do the latter i don't know.

Related

How can I tell Visual studio where my additional .dll files are?

I have recently switched my IDE to Visual Studio 2019 for C++ projects. I easily followed a tutorial into setting up a new library like SFML into visual studio, and tell it where the additional include and library directories are.
But there is something else that is required for it to work, which are the .dll files. Every page I followed, even the Documentation by the SFML website, it says that they have to be in the same directory as my project. That means I need to copy-paste the 7-8 files into my project directory. This really makes the folder look untidy. I would like to create a new folder and tell Visual Studio where those files are. I tried going doing this
Project -> Properties -> Linker -> Input -> Additional dependencies
Usually, the lines that would work are
sfml-system-d.lib
sfml-window-d.lib
...
I tried doing $(ProjectDir)valid path\ sfml-files.lib but this gives me the linker error, saying that It could not find the file.
If I simply move the .dlls into a folder without doing anything, the code would compile and link fine. But when it runs, Windows gives me a pop-up box with the same error message.
Here is how it currently looks
Looks really messy, I just want to be able to move them into dependencies like how src contains the source files.
How can I achieve this?
As it is now, it works perfectly fine. The issue only occurs when I try to create a new folder.
I hope I have covered the important information required for a good answer, If not please let me know what more I should add
Microsoft Visual Studio 2019
Currently running 64-bit platform with Debug configuration. Hence the -d suffix
You could create a path environment for your specified directory, which is like drescherjm’s suggestion. The steps:
Right-click “This PC” -> “Properties”-> “Advance System settings”
Click “Environment Variables”
In the System Variables group, edit “Path”
Add your directory, for example: ”D:\ SFML-2.5.1\bin”
Restart your visual studio and re-open your project
The easier solution might be to put them in the x64 subdirectory. This allows you to have various builds side by side (x86/x64, debug/release).
Since this x64 directory is where the EXE is located, it is the first directory searched for DLL's. It will take precedence over the Path solution suggested in the other answer. The Path directories are searched last of all.

Visual Studio 2019: Linking to folder

I am trying to link to a folder that is not inside the project directory. To give an example,
If my project is in C:\project and I have a folder C:\shared, how can I manage to link C:\shared into the project (and being able to edit/view the files in Solution Explorer) without making a copy of the directory and placing it into the project directory.
I need this due to the fact that many projects will use this folder and it would be ideal to have them edit/use the same files rather than copy the folder into each project individually. That way if a bug is fixed in one project, all other projects will now use the fixed files as well.
For more context, this is a C++ project using Visual Studio 2019.
What I've tried/considered.
Additional include directories
Problem: This does not show the files in the Solution Explorer
Dragging/dropping the folder (or copy/pasting) as seen in another StackOverflow thread.
Problem: This just crashes my visual studio completely. The folder is quite large so I assume that's related to why.
Appreciate any insight on how to proceed. It's really unfortunate that this is a pain, I would think that something like this would be common, but all the posts I've seen related to it have either gone unanswered or could not be applied to my situation.
Thanks.
Shared Projects are the key here.. I just found out they existed. After creating one, drop the folder/files in the same directory that has .vcxitems file. Now in the project you want to include the shared folder, right click your solution, Add -> Existing Project and select your .vcxitems file.

VS2015 C++ Mistakenly erased "Include Directories" and "Library Directories" in VC++ Directories Property Page

I recently installed VS2015 to look at a large library available online. As part of the set up it instructed to add boost to the Include and Library Directories in VC++ Directories in the properties for the solution. I mistakenly overwrote the fields instead of adding to them and these changes were saved. Now, predictably, nothing compiles. I don't know how to get them back to the original values, tried searching online for the values and have gone so far as to reinstall but boost is still the only thing in the fields.
I tried following This simple "Hello World" tutorial and can't even compile this. Could somebody please provide the default values for these fields, or instructions on how to restore them to the defaults?
Edit: I have tried creating a new solution and the fields are also empty apart from the boost folders, see image. Indeed, I had tried the simple Hello World tutorial on a fresh install before posting.
Step by Step Solution:
Create a new project/solution.
Add the boost directories, don't overwrite.
Delete the older project, as it is virtually useless.
EDIT
(If the above didn't work. This is work Win32 Console Apps Debug Config x86)
Here are the default include directories:
$(VC_IncludePath);$(WindowsSDK_IncludePath);
Here are the default library directories:
$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86

Importing C++ project in Xcode

How do I import a C/C++ project(NS3, GNU-Radio) to Xcode 7? The main reason I want to do this is to get autocompletion and Quick Help definitions. This can be done in Eclipse by:
File > New > 'Makefile Project with existing code'
It would be nice to have the debugger working as well but not necessary
The answers I have found are mostly for Xcode 4 and seem not to work on Xcode 7
Thanks
The easiest way is to drag and drop all files of the Sources folder into project Navigator of XCode directly from the file browser. That will pop up a wizard to import files into the project. At this point you will need to check the application name into the "add to target" field. Failure to do this would include the files into the project but without actually compiling them.
You do not need to update the include path because the Wizard has already do that for you.
Here is an example: https://www.youtube.com/watch?v=Fqovf9OghSM under OSX if it helps :)

Using sub projects in Visual Studio

I am quite used to Linux development and Makefiles, and started using (Windows and) Visual Studio not so long ago.
What I want to do is (I think) quite simple, but I can't seem to find how to do it using Visual Studio.
I have to write an application, which I can divide into several independent sub-parts. I want to work incrementally, and create several projects that together with a main file will end up with my full project.
What I basically want is to be able to write a small project, have a main for it so that I can fully test it, and use it as a dependency for the next project. In this case, the smaller main would be deactivated (or I can comment it), and I would just change the startup project.
If I find a bug in a subset while writing my bigger software, I could just change the startup project and solve it at a smaller scale.
Well, that's what I do all day long in Python and Java.
I tried to create new projects into my project, but I always end up having linking problems, where my main projects knows about the files in the sub projects, but not the smaller ones, etc. . .
So, is there a guide somewhere I can find to work this way ?
Thank you
For individual projects:
Every individual project property sheet has a C++ options page. Here you can specify the 'Addional Include Directories' in a comma separated form.
Similarly, there should be a property sheet for Linker where you can specify the 'Addional Include Dependencies' and the names of the libraries it depends on.
For linker dependencies of the main executable:
Go to that main project, go to its properties, go to common properties and select 'Framework and References'. This should give you a list of all the projecs that are in your solution. Keep adding them and Visual Studio should add the right linker flags automatically for you.
Sorry, have no access to the computer now else would have provided exact steps. Visual Studio can get tricky sometimes but once you use it, you'll be amazed by what it can do for you. Personally, I love it.
Hope this helps.
Thanks to Vaibhav, I was able to find a solution:
I had to :
change subproject type to lib instead of exe
Add the subprojects as project dependencies in the main project (this just sets the build order)
Comment out the main of my subprojects, to keep only one active.
Add each subproject include directory in the include repos of the main project, so that the compiler can find the header files
Add the general directory as a dependency for the linker (in this case, it is not the debug/release folder of the subprojects, but the output directory of the complete project).
Add the names of the lib files of the subprojects in additional dependencies of the linker of the main project.
To make it simple, the project dependencies capability of VS2010 just changes the order in which the projects are built. . . I miss Eclipse.
If I find a bug and want to test on of the subprojects, I have to :
change the startup project to be the subproject I want to change.
uncomment the corresponding main
change the project type to be exe instead of lib to be able to compile it.
Debug, and do everything back again to continue working on my main project.
Quite boring, don't you think ?
Looks like you trying to do manual unit testing. Use something like Google.Test. You need to make test project for every lib.
We have directory with static libs projects. Another directory with tests projects. Every test solution contains one exe project and few existing lib projects. Every project have configured dependencies. You dont need to set additional dependencies of the linker manually (paths are evil, out dir for the lib file will be taken from project settings), open project properties with right mouse button, Common properties, Add new reference and select lib project. You only need to set additional include dirs.
When you find new bug - just open test project for the library with bug, add code which cause the bug, fix it, and be happy (and sometimes run all test). And even better - use TDD.