Managing projects, libraries, etc under VC 4.0
Niels Ull Jacobsen -- nuj@kruger.dk
Sunday, January 14, 1996
To moderator: I'm not really sure whether this is appropriate for the list.
If it's not, where should I ask instead?
My project is as follows:
I have a main program, which depends on several DLL's and libraries.
Some of these libraries and DLL's are MSVC projects and some are not.
I would like to set it up so I can relatively easy switch between
debug mode, release mode and release mode with profiling.
One of the libraries (an MFC extension) can be build in both debug and
release mode, and have different interfaces in the two cases. As it is
relatively slow to build, I would prefer keeping two (or three)
versions of it around, mylib_d, mylib_r and mylib_rp.
One DLL is plain C, but links to the DLL version of the runtime
library. This is also rather slow to compile, so I would like to keep
it in various versions.
There are various ways to make it work.
I can add
#ifdef _DEBUG
#pragma comment(lib, "mylib_d.lib")
#else
#ifdef PROFILING
#pragma comment(lib, "mylib_rp.lib")
#else
#pragma comment(lib, "mylib_r.lib")
#endif
#endif
to mylib.h. Unfortunately, I lose the dependency checking in this way.
I can specify the correct libraries for the configuration on the "Link" tab.
Same problem.
I can add all of the libraries to my project, marking most of them as
"not included in build". This clutters up my main project a bit, but
may be the way to go. This could (perhaps) be wrapped into a subproject?
It seems the VC is smart enough to know that if I switch from "Debug"
to "Release" configuration in my main project, it should also switch
in all subprojects. But if i switch to "Profiling" and one of my
subprojects doesn't have a "Profiling" configuration, I would like it
to switch to "release". And so on..
What are the rest of you doing? I find that the online docs could have
been a bit more explicit about projects, subprojects, configurations
and targets.
--
Niels Ull Jacobsen, Kruger A/S
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger
group and should be taken as legally binding in every respect. Pigs
will grow wings and fly.
Raymond Fergerson -- rwf@CAMIS.Stanford.EDU
Wednesday, January 17, 1996
This is a real problem. Its a VC++ bug that linked libraries aren't
included in the dependency checking.
In VC2.X I had separate groups
which contained the libraries and used the "Don't include in build"
flag to get the ones I wanted. This kept the libraries from being
displayed with my real project files. In VC4 groups are gone so
this isn't an option.
What I'm doing now is to just have everything in the file list and
use the "Don't include" flag. This is not as bad as I thought that
it would be because I tend to use the class view rather than the file
view for most of my work now. If you aren't using the class view
I suggest trying it out for a day or two. It took me that long to
get used to it, but now I really like it.
Ray
Niels Ull Jacobsen wrote:
>
> To moderator: I'm not really sure whether this is appropriate for the list.
> If it's not, where should I ask instead?
>
> My project is as follows:
>
> I have a main program, which depends on several DLL's and libraries.
> Some of these libraries and DLL's are MSVC projects and some are not.
>
> I would like to set it up so I can relatively easy switch between
> debug mode, release mode and release mode with profiling.
>
> One of the libraries (an MFC extension) can be build in both debug and
> release mode, and have different interfaces in the two cases. As it is
> relatively slow to build, I would prefer keeping two (or three)
> versions of it around, mylib_d, mylib_r and mylib_rp.
>
> One DLL is plain C, but links to the DLL version of the runtime
> library. This is also rather slow to compile, so I would like to keep
> it in various versions.
>
> There are various ways to make it work.
> I can add
> #ifdef _DEBUG
> #pragma comment(lib, "mylib_d.lib")
> #else
> #ifdef PROFILING
> #pragma comment(lib, "mylib_rp.lib")
> #else
> #pragma comment(lib, "mylib_r.lib")
> #endif
> #endif
> to mylib.h. Unfortunately, I lose the dependency checking in this way.
>
> I can specify the correct libraries for the configuration on the "Link" tab.
> Same problem.
>
> I can add all of the libraries to my project, marking most of them as
> "not included in build". This clutters up my main project a bit, but
> may be the way to go. This could (perhaps) be wrapped into a subproject?
>
> It seems the VC is smart enough to know that if I switch from "Debug"
> to "Release" configuration in my main project, it should also switch
> in all subprojects. But if i switch to "Profiling" and one of my
> subprojects doesn't have a "Profiling" configuration, I would like it
> to switch to "release". And so on..
>
> What are the rest of you doing? I find that the online docs could have
> been a bit more explicit about projects, subprojects, configurations
> and targets.
>
> --
> Niels Ull Jacobsen, Kruger A/S
>
> Everything stated herein is THE OFFICIAL POLICY of the entire Kruger
> group and should be taken as legally binding in every respect. Pigs
> will grow wings and fly.
| Вернуться в корень Архива
|