CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    May 2009
    Posts
    9

    problem trying to build vs03 sln in vs05

    Hi,

    I'm trying to make a release build of some software, which I believe was originally compiled under vs03, under vs05.

    I've made a few changes to the source which works, and runs fine in debug mode. When I make a release build I get the following error:

    Error 4 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup LIBCMT.lib TaskSwitchXP
    Error 5 fatal error LNK1120: 1 unresolved externals c:\....\TaskSwitchXP\Release\TaskSwitchXP.exe 1 TaskSwitchXP

    Googling seemed to suggest I needed to change the compiler flag from /MT to /MD. This does indeed complete a release build without error. However, trying to run the exe I get:

    The procedure entry point DrawShadowText could not be located in the dynamic link library COMCTL32.dll.

    I don't know much about C++ or linking, but it appears to be trying to use a different version of this dll. However, why then does the debug build work fine, even when run from a standalong exe, but not the release build? How can I fix this? It's worth noting that the debug build is set to use /MTd still. The program itself does not contain this dll as a "side-by-side" dll in it's installed directory. I should also mention that this should be a native app, and not use any .NET or CLR functions.

    Thanks,
    Josh

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: problem trying to build vs03 sln in vs05

    Quote Originally Posted by joshuawood View Post
    Error 4 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup LIBCMT.lib TaskSwitchXP
    Error 5 fatal error LNK1120: 1 unresolved externals c:\....\TaskSwitchXP\Release\TaskSwitchXP.exe 1 TaskSwitchXP
    Are these the fourth and fifth error? If so, what are the first three errors? You should normally start solving errors from the top.

    Are you linking with any libraries outside your solution? If so, they could be dependent on a different version of the comctl32 library. You can check with a dependency walker.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    May 2009
    Posts
    9

    Re: problem trying to build vs03 sln in vs05

    I probably copied that text when I had other errors which are now solved. Those two are the only build errors. There are about 3 warnings due to depreciated compiler flags and such.

    I'm not sure what it's linking to, like I said I don't know that much about C++ coding. I imagine it's just the standard windows libraries, nothing third party. But yeah, my guess is it's trying to link to a different version of that dll, which has probably changed from vs03 to vs05. So how do I tell it to link to the new version and obtain a new entry point?

    What I don't understand is that the debug build works fine, so that must link to something which works, so why doesn't the release build do the same?

  4. #4
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: problem trying to build vs03 sln in vs05

    Quote Originally Posted by joshuawood View Post
    I'm not sure what it's linking to, like I said I don't know that much about C++ coding. I imagine it's just the standard windows libraries, nothing third party. But yeah, my guess is it's trying to link to a different version of that dll, which has probably changed from vs03 to vs05. So how do I tell it to link to the new version and obtain a new entry point?

    What I don't understand is that the debug build works fine, so that must link to something which works, so why doesn't the release build do the same?
    What differs between the debug and release build are mostly the project settings. You have to make sure that you use the same (or at least compatible) project settings for each project in your solution and also for any .lib file you link against that is not in your solution.

    So, first of all, I would check if all the project settings are the same.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  5. #5
    Join Date
    May 2009
    Posts
    9

    Re: problem trying to build vs03 sln in vs05

    They seem mostly the same. The biggest difference seems to be that the debug build is still using (and works) with the code generation /MTd, multi-threaded debug. But with the release set to /MT, which was the default, I get the link errors in post 1. Changing it to /MD built it, but I get the entry point error. Trying the debug build with /MDd, it again builds, but now I get MSVCR90D.dll not found instead. This file is on my computer. And if it needed it, how could it be build if this file wasn't found to reference?

    I'm not sure how to set the lib build settings. The solution only has 1 project, and there are no referenced libs or anything within the solution. Only header files, a resource file and the source files.

  6. #6
    Join Date
    Apr 2009
    Posts
    57

    Re: problem trying to build vs03 sln in vs05

    Your on the wrong track. You shouldn't have to edit any compilier/linker flags in most cases.


    Create an Empty project and copy the files into the project.


    Try this first before editing any flags(you shouldn't have to). Then you know what you'r getting into. If something doesn't work it's easier to find information on it, instead of changing Compilier/Linker flags.

  7. #7
    Join Date
    May 2009
    Posts
    9

    Re: problem trying to build vs03 sln in vs05

    I tried with an Empty project, added the files, and then had to fix a few linker issues (setting the subsystem and entry point). I copied the original vs03-vs05 upgraded soluntion linker info for this.

    Upon successful release build, I still get the same orginal entry point not found for DrawShadowText in comctl32.dll.

  8. #8
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: problem trying to build vs03 sln in vs05

    Perhaps you need to use a different version of comctl32.dll. To specify using version 6, you'll need to use a manifest file. Something like this:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity version="3.1.0.0" processorArchitecture="X86" name="MyApp" type="win32" />
      <description>What it does.</description>
      <dependency>
        <dependentAssembly>
          <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
        </dependentAssembly>
      </dependency>
    </assembly>
    Hope that helps.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  9. #9
    Join Date
    Apr 2009
    Posts
    57

    Re: problem trying to build vs03 sln in vs05


  10. #10
    Join Date
    May 2009
    Posts
    9

    Re: problem trying to build vs03 sln in vs05

    That's already correctly set:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
    <assemblyIdentity 
        version="1.0.0.0" 
        processorArchitecture="X86" 
        name="As12.TaskSwitchXP.TaskSwitch"
        type="win32" 
    /> 
    <description>TaskSwitchXP</description> 
    <dependency> 
        <dependentAssembly> 
            <assemblyIdentity 
                type="win32" 
                name="Microsoft.Windows.Common-Controls" 
                version="6.0.0.0" 
                processorArchitecture="X86" 
                publicKeyToken="6595b64144ccf1df" 
                language="*" 
            /> 
        </dependentAssembly> 
    </dependency> 
    </assembly>
    The debug build works fine, even as a standalone exe outside the IDE, so it must be linking to the correct dll version. The .rc file looks ok also, containing this line:

    1 RT_MANIFEST "res//TaskSwitchXP.manifest"

    Which makes no difference if I comment it out and replace it by the MS one suggested in the link given above:

    CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res//TaskSwitchXP.manifest"
    Last edited by joshuawood; May 28th, 2009 at 02:49 AM.

  11. #11
    Join Date
    Apr 2009
    Posts
    57

    Re: problem trying to build vs03 sln in vs05

    Hmm, at this point you would have to create a scaled down version of your project so others can see the problem.

    It's hard to give much more help without example code or a sample project.


    Try to create a scaled down project which exibits the problem.


    This might even solve your problem, sometimes trying to reproduce the problem in a fresh project pinpoints what you have been doing that is wrong.

  12. #12
    Join Date
    May 2009
    Posts
    9

    Re: problem trying to build vs03 sln in vs05

    Ok. I'm not in a position to make a smaller project from it as I'm not a C coder, and it's a massive project for me

    But the full solution is available here if anyone is interested in looking at it:

    http://www.ntwind.com/forum/viewtopic.php?p=2907#2907

    Thanks

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