Sign in to follow this  

Why is my VC++ application outputting a library?

This topic is 2590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I started a new project recently and noticing something strange with this one. I've made many visual studio projects before, but have never seen this.

When I compile my code, it outputs a .lib file as well as the executable.

1> Generating Code...
1> Creating library C:\Users\Tim\Code\Water\Debug\Water.lib and object C:\Users\Tim\Code\Water\Debug\Water.exp
1> Creating library C:\Users\Tim\Code\Water\Debug\Water.lib and object C:\Users\Tim\Code\Water\Debug\Water.exp
1> Water.vcxproj -> C:\Users\Tim\Code\Water\Debug\Water.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

I don't have any idea why it would generate a lib, and this message has no effect that I can tell on my successful running of the program, its just a curiosity that's made me curious. I haven't changed any settings that I know of that would cause this.

My configuration type is "Application (.exe)" (not .lib).

Also strange is that it seems to be creating it twice in the above example. Sometimes when I compile individual files it only does it once, but I'm forgetting at the moment which ones cause it and I can't reproduce it after a few seconds of trying.

My project command lines are these if it helps:
C++ Command Line:

/I"C:\SDKs\Assimp-1.1.7\include" /ZI /nologo /W3 /WX- /Od /Oy- /D
"SFML_DYNAMIC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1
/GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Debug\Water.pch" /Fa"Debug\"
/Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /FI"types.h" /FI"FIXME.h" /FI"Alert.h"
/analyze- /errorReport:queue


Linker Command Line:

/OUT:"C:\Users\Tim\Code\Water\Debug\Water.exe" /INCREMENTAL /NOLOGO
/LIBPATH:"C:\SDKs\Assimp-1.1.7\lib\assimp_debug_Win32" /LIBPATH:"C:\SDKs
\boost_1_44_0\bin.v2\libs\serialization\build\msvc-10.0\debug\link-static
\threading-multi" "sfml-system-d.lib" "sfml-graphics-d.lib" "sfml-window-d.lib"
"libboost_serialization-vc100-mt-gd-1_44.lib" "opengl32.lib" "glu32.lib"
"glew32.lib" "assimp.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" /MANIFEST
/ManifestFile:"Debug\Water.exe.intermediate.manifest" /ALLOWISOLATION
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Tim\Code
\Water\Debug\Water.pdb" /SUBSYSTEM:CONSOLE /PGD:"C:\Users\Tim\Code\Water\Debug
\Water.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE

Share this post


Link to post
Share on other sites
I've had the same thing happen with one of my projects and never did figure out the reason, so if anyone has an explanation for this, I wanna hear it, too. :)

Share this post


Link to post
Share on other sites
This happens because some third party library (.lib file) you are linking against has defined some of it's symbols with __declspec(dllexport) attribute. And MSVC linker, if it sees such declarations even for exe file, automatically generates import .lib library. You could check with some exe file analyzer tool (hiew32 for example) that your exe file actually contains export symbol section.

Solution for this is to rebuild this third party library to not define these symbols as dllexport-s. Usually this is done by defining some global THIRD_PARTY_NAME_STATIC preprocessor define.

Share this post


Link to post
Share on other sites

This topic is 2590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this