开发者

Visual Studio 2005 to VS 2008

开发者 https://www.devze.com 2022-12-26 16:16 出处:网络
I am a newbie in working on VS IDE and have not much experience in how the different libraries and files are linked in it. I have to build a OpenCV project which was made in VS2005 by one of my collea

I am a newbie in working on VS IDE and have not much experience in how the different libraries and files are linked in it. I have to build a OpenCV project which was made in VS2005 by one of my colleagues into VS2008. The project is for blob detection.

Following is what he has to say in readme :

Steps to use the library (using MSVC++ sp 5):

  1. open the project of the library and build it
  2. in the project where the library should be used, add:

    2.1 In "Project/Settings/C++/Preprocessor/Additional Include directories" add the directory where the blob library is stored

    2.2 In "Project/Settings/Link/Input/Additional library path" add the directory where the blob library is stored and in "Object/Library modules" add the cvblobslib.lib file

  3. Include the file "BlobResult.h" where you want to use blob variables.
  4. To see an example on using the blob library, see the file example.txt inside the zip file.

NOTE: Verify that in the project where the cvblobslib.lib is used, the MFC Runtime Libraries are not mixed:

  1. Check in "Project->Settings->C/C++->Code Generation->Use run-time library" of your project and set it to Debug Multithreaded DLL (debug version ) or to Multithreaded DLL ( release version ).
  2. Check in "Project->Settings->General" how it uses the MFC. It should be "Use MFC in a shared DLL".

NOTE1: The library can be compiled and used in .NET using this steps, but the menu options may differ a little NOTE2: In the .NET version, the character sets must be equal in the .lib and in the project. [OpenCV yahoo group开发者_Go百科: Msg 35500]

Can anyone explain me , how to go about in doing this in VS2008. I would also appreciate if someone can explain me how the different libraries are linked , what is Debug, What is Release and all in a Visual Studio project folder we have.\


I got confused by this at first as well as it's not very well explained by MSDN. Your best hope to learn it is to try linking to a library with VS2008 instructions (like boost).

Anyway, additional include directories is in Project->Properties->C++->General and additional libraries is in Project->Properties->Linker->General. You can put library names in additional libraries under Properties->Linker->Input.

So whenever you include a file it looks in your Include directories plus your additional include directories for that file. Whenever you specific an additional library (.lib file) it looks in your library directories plus any additional library directories.

If you use an include or library directory a lot, you can make it available for every solution by going to Tools->Options->Projects and Solutions->VC++ Directories and putting the directories you want in Include Files and Library Files respectively.

As for Debug vs Release, under Project->Properties there is a drop down menu in the top left which tells you which configuration you are currently editing the properties of. To change which one you currently want to build, click the "Configuration Manager" in the top right of project properties, and then use the drop down list to select configurations for each project.

Release usually has optimizations turned on etc, debug usually builds debugging databases (pdb files) etc. They also link to their respective libraries. In other words you usually need libraries you link to to match your configuration, so a debug build needs to link to a debug library and a release build needs to link to a release library. Usually libaries that are debug have a d following their name, and if they are multi-threaded have an mt in their name.

The C++->Code Generation advice they give you is still the same and is a common source or problems. It means the library you are linking to links to a different C library than then one you are using, which can cause problems.

It can get confusing, usually your best solution if you are confused is to ask the mailing list of whatever project you are trying to link to. If you get specific errors you can't figure out, try playing around with the configuration and if you still don't know, ask somewhere like here with your specific problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消