none
A bunch of error LNK2019: unresolved externals. Any clue why?? RRS feed

  • Question

  • Hello,

    I am using VS2005 and PB 6. I have a working image of CE that I created. I need to include an application, so I created a subproject to do this. I am getting a whole bunch of the errors:

    Error    81    BUILD: [01:0000000168:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol __imp__timeGetTime referenced in function_TurnOnIndicator 
    Error    82    BUILD: [01:0000000169:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol _ltoa referenced in function _InitComm       
    Error    83    BUILD: [01:0000000170:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol __imp__timeSetEvent referenced in function _Wait       
    Error    84    BUILD: [01:0000000171:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol __imp__timeKillEvent referenced in function _wait_for_busy       
    Error    85    BUILD: [01:0000000172:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol __imp__timeEndPeriod referenced in function _WinMain       
    Error    86    BUILD: [01:0000000173:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol __imp__timeBeginPeriod referenced in function _WinMain       

    I have these header files:

     

    #include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <StdAfx.h>
    #include "SEISrv32.h"   
    #include "SEICod32.h"   
    #include "SEIStructs.h"
    
    The code I am using is .c and was written to run on windows XP. I have put the code in a new .cpp and this will be running on CE.

     

    Some of these just might not be compatible with Windows CE, but I am not sure which ones and they are all needed, so any ideas of replacing them? Other functions I know should work just will not compile. I am all out of ideas.

     

    -Flip

     

    Wednesday, March 23, 2011 1:23 PM

Answers

  •  

    Did some more searching, turns out I did not place mmtimer.lib in the correct place it needs to be here:

     

    "So right click on the subproject, selected settings, then the link tab. In the "additional libraries" field, I already had:

    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib 

     
    You have to add the new library, which the only way I found was to separate them with a space:
    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\mmtimer.lib(note the space between the two paths)" -paulcsf

    This is what it looks like:

    I am still getting this error:
    Error 1 BUILD: [01:0000000049:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol _ltoa referenced in function _InitComm

    Anyone know what needs to be linked to get this one to work? I will continue looking and post back if I find.

     

    edit: the function is ltoa() with a lowercase 'L' not itoa(), just to clarify.



    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Wednesday, March 23, 2011 3:07 PM
  • You're putting the lib in the wrong place: in VS2005 select 'solution explorer' for you OS design, right click on your project and select properties: in the 'link' tab add mmtimer.lib to 'additional libraries'


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Wednesday, March 23, 2011 3:08 PM
  • ok try this:

    • verify that your OS design includes the 'full C runtime' catalog item.
    • create a new subproject choosing WCE console application, 'hello world' application
    • add
    int val = 123;
    char str[13];
    _ltoa(val, str,10);

    Does it build correctly?

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Monday, March 28, 2011 1:26 PM

All replies

  • Those functions are defined in Mmtimer.lib which you're probably not linking to


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, March 23, 2011 1:38 PM
  •  

    That is exactly what I thought too, because that is what I am finding all over where these problem exist.

    Sorry I should have said that I am linking mmtimer.lib or at least I think I am. This is a screen shot of what I did to link it. Hope it is correct. Also ltoa() is in mmtimer.lib?

     

     


    Also, I originally had mmtimer.lib there, tried with the capital M because that is what you wrote, but same results

    Wednesday, March 23, 2011 2:15 PM
  •  

    Did some more searching, turns out I did not place mmtimer.lib in the correct place it needs to be here:

     

    "So right click on the subproject, selected settings, then the link tab. In the "additional libraries" field, I already had:

    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib 

     
    You have to add the new library, which the only way I found was to separate them with a space:
    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\mmtimer.lib(note the space between the two paths)" -paulcsf

    This is what it looks like:

    I am still getting this error:
    Error 1 BUILD: [01:0000000049:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol _ltoa referenced in function _InitComm

    Anyone know what needs to be linked to get this one to work? I will continue looking and post back if I find.

     

    edit: the function is ltoa() with a lowercase 'L' not itoa(), just to clarify.



    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Wednesday, March 23, 2011 3:07 PM
  • You're putting the lib in the wrong place: in VS2005 select 'solution explorer' for you OS design, right click on your project and select properties: in the 'link' tab add mmtimer.lib to 'additional libraries'


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Wednesday, March 23, 2011 3:08 PM
  • Yes Luca thank you, if you notice my post right above you I said that and did what was suggested in a different post (the same thing you are saying).

     

    This got rid of all my errors except for one:

    Error 1 BUILD: [01:0000000049:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol _ltoa referenced in function _InitComm

     

    I cannot find why this is a problem. I do not see any other libs to link and I have all the headers. I just now tried changing ltoa() to itoa() since I think they are very similar. I still get the error:

    Error    1    BUILD: [01:0000000169:ERRORE] SEISrvCE.obj : error LNK2019: unresolved external symbol _ltoa referenced in function _InitComm       

    even though it is now itoa() instead of ltoa()     <- lowercase 'L' not a 'I'


    Wednesday, March 23, 2011 3:41 PM
  • you need to link to the C runtime library which must be included in your OS design also
    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, March 23, 2011 4:02 PM
  • Do you  know the location of this in the form of:

    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib

    or

    $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\mmtimer.lib

     

    I am assuming this is what I need to link as the one is the default and the other got rid of the other errors. I am not having luck finding it.

    Wednesday, March 23, 2011 4:10 PM
  • Which is the entry point of your application? you can check it in the project properties C/C++ tab: if you set it to mainWCRTStartup or WinMainCRTStartup the C library will be implicitely linked


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Thursday, March 24, 2011 7:38 AM
  • Luca, thank you for helping me with this, but I checked and under the C/C++ tab > Executable Entry Point: WinMainCRTStartup is already there.

     

    Is there anything else that could cause this error?

    *edit*

    Is ltoa() even compatible with Windows CE? I looked here:

    http://msdn.microsoft.com/en-us/library/6y51bcy2%28v=vs.80%29.aspx

     

    Windows CE is not listed. What could I use besides it?


    Friday, March 25, 2011 6:35 PM
  • try _ltoa
    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Saturday, March 26, 2011 2:27 PM
  • Old line of code:

    AddErrorMessage(ltoa(comm, msg, 10));    // port #

    New line of code:

    AddErrorMessage(_ltoa(comm, msg, 10));    // port #

     

    Still same error message....?

    Monday, March 28, 2011 1:17 PM
  • ok try this:

    • verify that your OS design includes the 'full C runtime' catalog item.
    • create a new subproject choosing WCE console application, 'hello world' application
    • add
    int val = 123;
    char str[13];
    _ltoa(val, str,10);

    Does it build correctly?

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    • Marked as answer by Rob Filippi Monday, March 28, 2011 2:31 PM
    Monday, March 28, 2011 1:26 PM
  • Luca,

     

    What you suggested did build correctly. I am not sure why it will not in the other subproject. I decided to replace ltoa with sprintf.

     

    This seemed to get it to work correctly (it builds). Thank you for helping me through this.

     

    An example:

    Was:

    ltoa(outbuf[1], str, 16);

    Now:

    sprintf(str, "%x", outbuf[1]);

     

    Is this a correct way of substituting ltoa since it will not work on other subproject?

     

    Rob

     

     

    Monday, March 28, 2011 2:30 PM