Need help on really noob question about VC2005

Started by
3 comments, last by TheGilb 16 years, 5 months ago
Hi guys I'm very new in VC IDE, I'm using VC2005 as my IDE for C++ project. the problem is, I'm already created reusable files (as my game engine). But when I pretend to reuse them I need to copy and paste to the new folder (new project/ or new solution). I can't set the other project/solution to point to the same files (h and cpp). Even I try to add include file to the same folder, Link error occur. anyone can give me suggestion on this problem, since now I try to set up third project that use the same files. so I need to copy and paste more often and some time I forget which one is the last updated. Thank you Chet Chetchaiyan
Advertisement
Right-click you project name at the Solution Explorer and go to Properties(or menu Project>Properties). Then in the C/C++>General section, look for 'Additional Include Directories' and insert the directories where your headers are located. And in the Link>General section, look for 'Additional Library Directories' and insert the directories where your .libs reside.

HTH
.
The problem is my own code didn't .lib it's just a part of code in the project that out put as .exe, I don't know how to make the output to be .lib files
Oh thank you. It's work. I don't know that making .lib files didn't require to change any coding.

as I always look in open source lib file all of them use 'extern' or somethings so I think export .lib requires extra code

Thank you any ways ^_^
If your source files aren't in a static library (.lib) then you need to add the source files to the project as well. Just right click on your project and then add existing files.

The prefered method is the keep all of your reusable code in a static library. To do this add a new project to the solution (C++ -> Win32 Application -> Static Library), and set up your includes / source files and add them all into the new project.

When you want to use your library the easiest way is to right click your project and then click on dependencies. Check the box next to your project and the linker will link the correct lib file. Just remember to set up your directories for header files in your project.

Hope that helps!

This topic is closed to new replies.

Advertisement