CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2006
    Posts
    46

    speeding up use of first static library

    I'm using VC++ 2010 express + windows sdk on win7 64 Home Premium (Phenom 8450 4Gb Ram).

    I just created my first static library which is sqlite3.c in 64bit guise.

    To test it I used a std win32 project...albeit changed into an x64/debug project
    with precompiled headers and using the windows sdk platform toolset for 64bit compilation.
    I only added a couple of lines to the auto-generated .cpp file test the sqlite library.

    Whilst the test "worked"...building it took 30seconds.
    Is this normal?
    I got these messages but at the moment they don't mean much to me.
    I'd welcome any advice re speeding things up...if possible.
    Thank you in anticipation.


    Code:
    	1>------ Rebuild All started: Project: test_sqlite64, Configuration: Debug x64 ------
    	1>  stdafx.cpp
    	1>  test_sqlite64.cpp
    	1>  sqlite64.lib(sqlite3.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    	1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
    	1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    	1>  Generating code
    	1>  Finished generating code
    	1>  test_sqlite64.vcxproj -> C:\Users\me\documents\visual studio 2010\Projects\test_sqlite64\x64\Debug\test_sqlite64.exe
    	1>  sqlite64.lib(sqlite3.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    	1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
    	1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    	1>  Generating code
    	1>  Finished generating code
    	1>  test_sqlite64.vcxproj -> C:\Users\me\documents\visual studio 2010\Projects\test_sqlite64\x64\Debug\test_sqlite64.exe
    	========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

    It looks like I should remove '/INCREMENTAL'.
    I did with
    Properties/linker/general.../INCREMENTAL No!
    and now get this

    Code:
    1>------ Rebuild All started: Project: test_sqlite64, Configuration: Debug x64 ------
    1>  stdafx.cpp
    1>  test_sqlite64.cpp
    1>  sqlite64.lib(sqlite3.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    1>  Generating code
    1>  Finished generating code
    1>  test_sqlite64.vcxproj -> C:\Users\me\documents\visual studio 2010\Projects\test_sqlite64\x64\Debug\test_sqlite64.exe
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

    I found
    Linker/Input/Ignore specific default libraries
    and added MSVCRT to it
    I now get...
    Code:
    1>------ Rebuild All started: Project: test_sqlite64, Configuration: Debug x64 ------
    1>  stdafx.cpp
    1>  test_sqlite64.cpp
    1>  sqlite64.lib(sqlite3.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    1>  Generating code
    1>  Finished generating code
    1>  test_sqlite64.vcxproj -> C:\Users\me\documents\visual studio 2010\Projects\test_sqlite64\x64\Debug\test_sqlite64.exe
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

    I added "/GL /LTCG" to properties/linker/command line/additional options and press apply/ok and get this...
    Code:
    I added 1>------ Rebuild All started: Project: test_sqlite64, Configuration: Debug x64 ------
    1>cl : Command line warning D9002: ignoring unknown option '/LTCG'
    1>  stdafx.cpp
    1>cl : Command line warning D9002: ignoring unknown option '/LTCG'
    1>  test_sqlite64.cpp
    1>  stdafx.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    1>  Generating code
    1>  Finished generating code
    1>  test_sqlite64.vcxproj -> C:\Users\me\documents\visual studio 2010\Projects\test_sqlite64\x64\Debug\test_sqlite64.exe
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
    It's now taking 15 seconds i.e. 1/2 the time.
    BTW Why is the compiler asking me to add /LTCG and then not recognising it?


    http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx
    suggests replacing or adding to 'MSVCRT' the phrase /NODEFAULTLIB:MSVCRT
    The link also mentions this
    Code:
    "different types or debug and non-debug versions of the run-time library in the same program"
    My static lib was compiled as a RELEASE x64 whereas the test project is a DEBUG x64. Is this ok?
    Last edited by fpga; June 16th, 2011 at 04:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured