I have GradeBook.h that include class interface, GradeBook.cpp that include class implemantation, I want to make a lib file and use it with GradeBook.h on the other project. How can I do that ?
I am using Windows 7, VS 2008
I have GradeBook.h that include class interface, GradeBook.cpp that include class implemantation, I want to make a lib file and use it with GradeBook.h on the other project. How can I do that ?
I am using Windows 7, VS 2008
I would store the files in a location easily accessible from both projects then include them in the project(s) respective solutions...
Unless you're trying to make a DLL or something, then I can't help you...
I would store the files in a location easily accessible from both projects then include them in the project(s) respective solutions...
Unless you're trying to make a DLL or something, then I can't help you...
If I want to make a dll from GradeBook.h GradeBook.cpp. How I can do it and How Can I use this dll with GradeBook.h on the other project ?
If I want to make a dll from GradeBook.h GradeBook.cpp. How I can do it and How Can I use this dll with GradeBook.h on the other project ?
I unfortunately can't help you with that. I know you will still need a modified version of GradeBook.h so that you have an interface for your program and that GradeBook.cpp will compile into the actual DLL with the proper modifications. However, I do not know the required syntax. I'm very much a newb in that department.
I unfortunately can't help you with that. I know you will still need a modified version of GradeBook.h so that you have an interface for your program and that GradeBook.cpp will compile into the actual DLL with the proper modifications. However, I do not know the required syntax. I'm very much a newb in that department.
This link is very helpful I think I will do what I want. I am trying the instructions on the link.
http://msdn.microsoft.com/en-us/library/ms235627.aspx
This link is very helpful I think I will do what I want. I am trying the instructions on the link.
http://msdn.microsoft.com/en-us/library/ms235627.aspx
Thx for the link. I actually have a downloaded copy of the MSDN Library, I just haven't gotten to/through this part yet.
I did the library file with a lib project.
Lib project:
Fıle->new->project.... On Application Settings windows I chose static library and empty project settings and built it.
vs2008
But on the link, it is making a the project that is using the lib project. That is useless. The project should use just the lib file not the project.
note lib project: that only include header file and cpp file that includes only class implementation.
If all you want to share is a header file and *.cpp file then I wouldn't bother making a DLL because that is like killing a fly with a sludgehammer. Instead, just create a static library project and add those two files to it. Then in each of the application programs just link with that library.
If all you want to share is a header file and *.cpp file then I wouldn't bother making a DLL because that is like killing a fly with a sludgehammer. Instead, just create a static library project and add those two files to it. Then in each of the application programs just link with that library.
I did the lib file from header file and the cpp(I built them when the project is a static library) I don't want to make a dll too. How can I link that .lib file when I make other projects ?
I did linking.
1. Tools/Options/Projects and Solutions/VC++ directories/
Platform "Win32" ShowDirectories for "library files"
and I added the folder to here that include my .lib file.
2. Project/ "your project" properties/ Configuration Properties/Linker/Input/Additional Dependencies
and I added my lib file "lib.lib" to here
that is it.
and If you want to use a *.h file that is made before in your project without add the header file to your project (just #include it in main)
and add here your folder that include your header file.
and you can now built your project without header and source file(class implementation) just with a main.cpp file.
#include"GradeBook.h"
int main()
{
GradeBook grade1("sdgdg");
grade1.displayMessage();
return 0;
}
#include"GradeBook.h"
this is wrong sorry :(probably the project will be built with no errors)
#include<GradeBook.h>
that will be true way Because this file is'nt in the project folder it is in a folder that you specified in Project/ "your project" properties/ Configuration Properties/C/C++/Additional Include Directories
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.