vc++ compile log, plg file.

发布时间 2023-09-12 11:07:29作者: 不及格的程序员-八神

.plg 是编译信息文件,编译时的error和warning信息文件(实际上是一个html文件),一般用处不大.

在Tools->Options里面有个选项可以控制这个文件的生成;

vc++ compile log

question 1:

When I compile my C program with without MFC support.  In the build
log file (test.plg).  It shows
======================================================
... etc ...
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes
/pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe"
/pdbtype:sept
.\Debug\unchain.obj
======================================================
does all these library files are c / c++ library files?  I wonder
which library contains standard C library ( e.g stdio for example ).
Which library contains standard C++ library?
And in linking step, It shows:
======================================================

======================================================
Does VC++ use link.exe to link non-MFC library to form executable?  

question 2:

When I compile with MFC support.  In the build log file ( test.plg).
It shows:
=====================================================
... etc ...
/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
/D "_MBCS" /Fp"Debug/test.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

"D:\vc\test\unchain.cpp"
=====================================================
what are the above command means?  where it specific the libraries?
It looks like all of them are switch.
And in linking step. It shows:
=====================================================

=====================================================
Does VC++ use a different linker other than link.exe to link MFC
library to form executable?

thanks .



Sat, 21 Feb 2004 04:54:06 GMT  
 vc++ compile log
I don't understand everything in the log files but I can explain a few
things.

1) link.exe is the linker, for MFC and non-MFC programs. MFC is just a
library and it uses the usually header file, library, DLL and linker
conventions
to hook itself in.

2) The .lib files that are specified in your non-MFC program are for
linking
to Windows DLLs - user32.lib links you to user32.dll.

3) MFC uses a compiler command - #pragma comment(lib, "libname.lib") -
to specify what libraries should be pulled in. This information is
embedded
in the .obj files, which is why the libraries aren't listed on the linker
command
line. You are free to use this #pragma for your own purposes as well.

4) The C run time libraries are msvcrt(d).lib, crt(d).lib and one other
set,
depending on what options you select. Some of the C++ support is in there,

some is in msvcp60(d).dll or msvcirt(d).dll. Those DLLs don't show up in
the
command line because their names are embedded in the .obj files, although
it isn't through a #pragma.

Most people never look at the log files. I'm sure it can be very
educational,
but don't use it as your primary means of understanding or you may get
hung up unnecessarily.

Quote:

> question 1:

> When I compile my C program with without MFC support.  In the build
> log file (test.plg).  It shows
> ======================================================
> ... etc ...
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes
> /pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe"
> /pdbtype:sept
> .\Debug\unchain.obj
> ======================================================
> does all these library files are c / c++ library files?  I wonder
> which library contains standard C library ( e.g stdio for example ).
> Which library contains standard C++ library?
> And in linking step, It shows:
> ======================================================
> Creating command line "link.exe

> ======================================================
> Does VC++ use link.exe to link non-MFC library to form executable?

> question 2:

> When I compile with MFC support.  In the build log file ( test.plg).
> It shows:
> =====================================================
> ... etc ...
> /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
> /D "_MBCS" /Fp"Debug/test.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

> "D:\vc\test\unchain.cpp"
> =====================================================
> what are the above command means?  where it specific the libraries?
> It looks like all of them are switch.
> And in linking step. It shows:
> =====================================================
> Creating command line "cl.exe

> =====================================================
> Does VC++ use a different linker other than link.exe to link MFC
> library to form executable?

> thanks .



Sat, 21 Feb 2004 06:18:06 GMT  
 vc++ compile log

 

Quote:

> question 1:

> When I compile my C program with without MFC support.  In the build
> log file (test.plg).  It shows
> ======================================================
> ... etc ...
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes
> /pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe"
> /pdbtype:sept
> .\Debug\unchain.obj
> ======================================================
> does all these library files are c / c++ library files?

No. Most of them are components of Win32.

 

Quote:
> I wonder
> which library contains standard C library ( e.g stdio for example ).
> Which library contains standard C++ library?

In the MSDN, search for a function defined in <stdio.h>, say printf(). The
help entry includes this:

"Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version "

 

Quote:
> And in linking step, It shows:
> ======================================================
> Creating command line "link.exe

> ======================================================
> Does VC++ use link.exe to link non-MFC library to form executable?

Yes.

 

Quote:

> question 2:

> When I compile with MFC support.  In the build log file ( test.plg).
> It shows:
> =====================================================
> ... etc ...
> /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
> /D "_MBCS" /Fp"Debug/test.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

> "D:\vc\test\unchain.cpp"
> =====================================================
> what are the above command means?

Click on the "Settings" item of the "Project" menu in the IDE. Then click
the "C++" tab. At the bottom of the form you will see a list of all of the

command line options passed to the compiler (cl.exe"). To see the link
options click the "Link" tab.

 

Quote:
> where it specific the libraries?

On the "Link" tab choose the "Input" option in the combo box. The list of
libraries appears in the first edit control.

 

Quote:
> Does VC++ use a different linker other than link.exe to link MFC
> library to form executable?

No. The IDE creates a make file that invokes cl.exe and link.exe unless you
change it.

Regards,
Will



Sat, 21 Feb 2004 06:40:15 GMT  
 vc++ compile log
Will,

But do you mean cl.exe is the vc++ compiler & link.exe is the vc++
linker?
===========================================
And you said:
"In the MSDN, search for a function defined in <stdio.h>, say
printf(). The
help entry includes this:
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version "
   -------------------------------
does the above means u can static link stdio.h functions into ur
executable(LIBC.LIB/LIBCMT.LIB) or dynamic link with MSVCRT.DLL at
runtime?
===========================================
does c/c++ tab in (project settings) changes complier options & link
tab changes linker options?

thanks again.

On Mon, 3 Sep 2001 18:40:15 -0400, "William DePalo [MVP]"

Quote:



>> question 1:

>> When I compile my C program with without MFC support.  In the build
>> log file (test.plg).  It shows
>> ======================================================
>> ... etc ...
>> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
>> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
>> odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
>> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
>> odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes
>> /pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe"
>> /pdbtype:sept
>> .\Debug\unchain.obj
>> ======================================================
>> does all these library files are c / c++ library files?

>No. Most of them are components of Win32.

>> I wonder
>> which library contains standard C library ( e.g stdio for example ).
>> Which library contains standard C++ library?

>In the MSDN, search for a function defined in <stdio.h>, say printf(). The
>help entry includes this:

>"Libraries

>LIBC.LIB Single thread static library, retail version
>LIBCMT.LIB Multithread static library, retail version
>MSVCRT.LIB Import library for MSVCRT.DLL, retail version "

>> And in linking step, It shows:
>> ======================================================
>> Creating command line "link.exe

>> ======================================================
>> Does VC++ use link.exe to link non-MFC library to form executable?

>Yes.

>> question 2:

>> When I compile with MFC support.  In the build log file ( test.plg).
>> It shows:
>> =====================================================
>> ... etc ...
>> /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
>> /D "_MBCS" /Fp"Debug/test.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

>> "D:\vc\test\unchain.cpp"
>> =====================================================
>> what are the above command means?

>Click on the "Settings" item of the "Project" menu in the IDE. Then click
>the "C++" tab. At the bottom of the form you will see a list of all of the
>command line options passed to the compiler (cl.exe"). To see the link
>options click the "Link" tab.

>> where it specific the libraries?

>On the "Link" tab choose the "Input" option in the combo box. The list of
>libraries appears in the first edit control.

>> Does VC++ use a different linker other than link.exe to link MFC
>> library to form executable?

>No. The IDE creates a make file that invokes cl.exe and link.exe unless you
>change it.

>Regards,
>Will



Sat, 21 Feb 2004 08:53:13 GMT  
 vc++ compile log
But in directory
C:\Program Files\Microsoft Visual Studio\VC98\Lib

I saw :
1) object file (.OBJ) (.PDB)
2) library file (.LIB)
3) DLL (.DLL)

I wonder why not put all object files into library files?  I read a
book said if you link with an object file. you will include everything
into exectable.  While if link with library file. you look up a
function in libaray and only include specific function into
executable.

what's the file with .PDB extension?  Is it same as object file?  

And in directory:
C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC
are those MFC source code?  

thanks again.

On Mon, 03 Sep 2001 15:18:06 -0700, Bruce Dawson

Quote:

>I don't understand everything in the log files but I can explain a few
>things.

>1) link.exe is the linker, for MFC and non-MFC programs. MFC is just a
>library and it uses the usually header file, library, DLL and linker
>conventions
>to hook itself in.

>2) The .lib files that are specified in your non-MFC program are for
>linking
>to Windows DLLs - user32.lib links you to user32.dll.

>3) MFC uses a compiler command - #pragma comment(lib, "libname.lib") -
>to specify what libraries should be pulled in. This information is
>embedded
>in the .obj files, which is why the libraries aren't listed on the linker
>command
>line. You are free to use this #pragma for your own purposes as well.

>4) The C run time libraries are msvcrt(d).lib, crt(d).lib and one other
>set,
>depending on what options you select. Some of the C++ support is in there,

>some is in msvcp60(d).dll or msvcirt(d).dll. Those DLLs don't show up in
>the
>command line because their names are embedded in the .obj files, although
>it isn't through a #pragma.

>Most people never look at the log files. I'm sure it can be very
>educational,
>but don't use it as your primary means of understanding or you may get
>hung up unnecessarily.

 

>> question 1:

>> When I compile my C program with without MFC support.  In the build
>> log file (test.plg).  It shows
>> ======================================================
>> ... etc ...
>> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
>> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
>> odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
>> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
>> odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes
>> /pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe"
>> /pdbtype:sept
>> .\Debug\unchain.obj
>> ======================================================
>> does all these library files are c / c++ library files?  I wonder
>> which library contains standard C library ( e.g stdio for example ).
>> Which library contains standard C++ library?
>> And in linking step, It shows:
>> ======================================================
>> Creating command line "link.exe

>> ======================================================
>> Does VC++ use link.exe to link non-MFC library to form executable?

>> question 2:

>> When I compile with MFC support.  In the build log file ( test.plg).
>> It shows:
>> =====================================================
>> ... etc ...
>> /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
>> /D "_MBCS" /Fp"Debug/test.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

>> "D:\vc\test\unchain.cpp"
>> =====================================================
>> what are the above command means?  where it specific the libraries?
>> It looks like all of them are switch.
>> And in linking step. It shows:
>> =====================================================
>> Creating command line "cl.exe

>> =====================================================
>> Does VC++ use a different linker other than link.exe to link MFC
>> library to form executable?

>> thanks .



Sat, 21 Feb 2004 09:04:14 GMT  
 vc++ compile log

 

Quote:
> But do you mean cl.exe is the vc++ compiler & link.exe is the vc++
> linker?

What do you mean what do I mean? :-)

Look at the directory

    \program files\microsoft visual studio\vc98\bin

on the disk where you installed VC/C++. You will find several executables.
Among them:

        cl.exe   ==> compiler
        link.exe   ==> linker
        lib.exe ==> librarian
        nmake.exe ==> make utility

These tools can run at the command line. In addition the IDE knows how to
direct their outputs to the output window.

 

Quote:
> ===========================================
> And you said:
> "In the MSDN, search for a function defined in <stdio.h>, say
> printf(). The
> help entry includes this:
> LIBC.LIB Single thread static library, retail version
> LIBCMT.LIB Multithread static library, retail version
> MSVCRT.LIB Import library for MSVCRT.DLL, retail version "
>    -------------------------------
> does the above means u can static link stdio.h functions into ur
> executable(LIBC.LIB/LIBCMT.LIB) or dynamic link with MSVCRT.DLL at
> runtime?
> ===========================================

Yes.

 

Quote:
> does c/c++ tab in (project settings) changes complier options & link
> tab changes linker options?

Yes.

 

Quote:
> thanks again.

You are welcome.

Regards,
Will



Sat, 21 Feb 2004 09:45:02 GMT  
 vc++ compile log

 

Quote:
> I saw :
> 1) object file (.OBJ) (.PDB)
> 2) library file (.LIB)
> 3) DLL (.DLL)

> I wonder why not put all object files into library files?

That is an option but it is always a second step. That is a source file is
compiled to an object file. One or more object files can be inserted into a
library.

 

 

Quote:
> I read a  book said if you link with an object file. you will include
everything
> into exectable.  While if link with library file. you look up a
> function in libaray and only include specific function into
> executable.

That's true. But if, for example, the function foo() lives in foo.obj and if
foo.obj is inserted into foo.lib, and if you need to call foo() in your

program, the linker will add it in either case. It hardly matters where it
came from.

Libraries are most useful for collecting a set of related objects into a
single file. Then to use any of the functions in the library you have only
to specify the library to the linker.

 

Quote:
> what's the file with .PDB extension?  Is it same as object file?

That's the program data base. It contains debug information. It is not an
object file.

 

Quote:
> And in directory:
> C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC
> are those MFC source code?

Yup.

Regards,
Will