C++ confusion

Started by
2 comments, last by MarsTeam 13 years, 2 months ago
Hello, I would like to read up more information on this topic and I'm trying to find some good article/s where it would be well explain. My confusion is, that I have these header files (.h), then lib files which I setup at VC Express 2010 in Additional Dependancies, then there are DLL files... basically what's difference between them, and if I want to move my program from PC A to PC B, which files do I need to move. Do I need to move these lib files (and include files), which are located god-knows-where on PC A to same location on PC B (since I set it up in PROJECT OPTIONS... or once it's compiled it doesn't matter?) ? Or how does it work ? I'm really a bit confused :)

Some good long article, where it would be well explained would be very much appreciated.

Thanks for help.
Advertisement

Hello, I would like to read up more information on this topic and I'm trying to find some good article/s where it would be well explain. My confusion is, that I have these header files (.h), then lib files which I setup at VC Express 2010 in Additional Dependancies, then there are DLL files... basically what's difference between them, and if I want to move my program from PC A to PC B, which files do I need to move. Do I need to move these lib files (and include files), which are located god-knows-where on PC A to same location on PC B (since I set it up in PROJECT OPTIONS... or once it's compiled it doesn't matter?) ? Or how does it work ? I'm really a bit confused :)

Some good long article, where it would be well explained would be very much appreciated.

Thanks for help.


Headers provide the interface to the library. The library itself contains the executable code, you will need to move both, and any required dlls(check your EULA for legal issues) if you intend to compile on another machine. If you are only going to run the compiles executable on another machine, then you only need the .exe and any .dll files.
.h files provide you with the definitions of methods and data that are found in the .lib. .lib differs from .dll in that .lib are compiled into your final executable where as a .dll is linked in dynamically at run time.

As for moving additional things that you personally have added to the project. You will have to have everything that you are using on both PCs. There are a few ways to handle moving from computer A to B. First of which is install everything on PC B the same way it was installed on PC A.

Another way, which happens to be the way I personally handle external dependencies, is I add them relative to the project solution and then that way when I am moving from one computer to another I don't need to worry about whether or not it has every thing I need because everything I need is bundled up with the project.

Q: But isn't this more work up front than just installing the stuff on the other computer?
Yes, but imagine what happens when you want to go to a computer you don't have the permissions to install things on? What do you do then?
What if you have someone else helping with the project? Are they expected to setup their computer to be just like yours? (Good luck with that one. In my case all of my development stuff is on my Y: drive. Do you have a Y: drive? =D )

-----

To be honest any way you do it it can lead to problems. So, which ever way works easier for your situation is probably the best.
"My word is my bond and here I stand."

.h files provide you with the definitions of methods and data that are found in the .lib. .lib differs from .dll in that .lib are compiled into your final executable where as a .dll is linked in dynamically at run time.

As for moving additional things that you personally have added to the project. You will have to have everything that you are using on both PCs. There are a few ways to handle moving from computer A to B. First of which is install everything on PC B the same way it was installed on PC A.

Another way, which happens to be the way I personally handle external dependencies, is I add them relative to the project solution and then that way when I am moving from one computer to another I don't need to worry about whether or not it has every thing I need because everything I need is bundled up with the project.

Q: But isn't this more work up front than just installing the stuff on the other computer?
Yes, but imagine what happens when you want to go to a computer you don't have the permissions to install things on? What do you do then?
What if you have someone else helping with the project? Are they expected to setup their computer to be just like yours? (Good luck with that one. In my case all of my development stuff is on my Y: drive. Do you have a Y: drive? =D )

-----

To be honest any way you do it it can lead to problems. So, which ever way works easier for your situation is probably the best.



Thanks. I wanted to do it your way, just wasn't sure it's best idea.
So I should now copy lib and include files into project directory, and change project settings to relative paths ? Would that also mean to change includes such as

Thanks =)

EDIT: done it, works flawlessly, thanks for help

This topic is closed to new replies.

Advertisement