Start a new topic

MicroSoft Visual Studio 10 linker stinker

Original Post by: KentNichols Wed Aug 3 15:58:42 2011


We recently upgraded our machines to run Windows 7, and a the same time upgraded MSVS to version 10 (not by choice). We have several executable tools that run on the API, and brought the old project in and tried to rebuild but the liner doesn't seem to see the api libraries.


We tried recompiling the examples, still no joy.


the environment variables appear correct, and we've been through the project with a fine couth tomb 8*) but can't find anything wrong.


Anybody run into this and have any suggestions?


Original Post by: thurman Wed Aug 3 17:12:52 2011


Additional info on the problem Kent reported The error messages say;


error LNK2019: unresolved external symbol _mgInit referenced in function "private: void __thiscall CFlight2TextDlg::ProcessFile(class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &)" (?ProcessFile@CFlight2TextDlg@@AAEXAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@000@Z


It does this for every mg call. So instead of looking for mgInit, its' looking for _mgInit


Does the underscore just denote an instantiation of the code dumped from the linker, or is it a true indicator of the problem?

Original Post by: SteveThompson Wed Aug 3 23:35:28 2011


Which version and compiler of the OpenFlight API libraries are you using?


i.e. you are using OpenFlight API version X compiled for Visual Studio version Y.

What are X and Y?

Possible values for X are 2.6, 3.0, ..., 4.2

Possible values for Y are VC6 and VS2005


Once we know this, we can help you further diagnose.

Thanks.

Original Post by: SteveThompson Wed Aug 3 23:44:55 2011


error LNK2019: unresolved external symbol _mgInit referenced in function “private: void __thiscall CFlight2TextDlg::ProcessFile(class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &,class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &)” (?ProcessFile@CFlight2TextDlg@@AAEXAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@000@Z

The "underscore" on the front of mgInit is a red herring in this error message. The OpenFlight API functions use the _cdecl calling convention so when API functions (like mgInit and the rest) are compiled/linked into the OpenFlight API export library file, they are "exported" using this form of "name mangling". Again... this is normal. See http://en.wikipedia.org/wiki/Name_mangling for more information.


Note that this message is the same you would see if the linker was NOT told to include the file mgapilib.lib in the Additional Dependencies on the Linker>Input property page in Visual studio. Although I don't see this message when I build the API sample apps in VC10 (using VS2005 API) I suspect you might see this is you're missing mgapilib.lib in the Additional Dependencies or your version of mgapilib.lib is somehow unrecognizable to VC10.

Original Post by: KentNichols Thu Aug 4 13:28:35 2011


I figured the _ was not germane but we have to ask everything, especially when it concerns MS VC! My old-school SGI O2 with, of all things, MAKEFILES was pretty easy for me to understand.


We've chased red, green, and blue herrings all over, and yes, it appears as if the mgapilib.lib is unrecognizable for whatever reason. We've checked Additiona Dependencies, and even co-located the library. Looking at the logs it shows up in the link line.


What exact version of the API are you using that is successful? I believe we are using 4.1 VC8 from the install disk, if there are better versions or others that may work, or others that have been proven to work with VC 10 i would love to know!

Original Post by: thurman Thu Aug 4 14:04:25 2011


We had our machines upgraded to 64 bit, and we were involuntarily moved to VS 10.0.40219.1. We are using OpenFlight API version 4.1 I also use GL Studio here with VS 10, and after getting their latest software, I am able to compile a GL Studio solution using VS 10. The Presages solution that I'm having trouble with is mature code that I wrote some time ago. I brought it into VS 10, and VS 10 converted it. After many unsuccessful trials, I tried creating a totally new solution and just bringing in the original C++ code. Once I had everything right with the project properties, I had exactly the same errors as the converted code. I didn't think the underscore was germane, I just had to ask. I am aware that the errors indicate that I am not telling VS the correct library name, but this is something that I have checked many times, and had Kent check as well just in case Senior Dyslexia was rearing it's ugly head, but no, the library references are correct.

Original Post by: thurman Thu Aug 4 14:42:12 2011


And as Kent wrote, our latest version of Creator (4.1), included OpenFlight API 4.1, which the installation disk says was compiled against VC8, while Visual Studio 2010 contains VC100.

Original Post by: SteveThompson Thu Aug 4 14:52:31 2011


What exact version of the API are you using that is successful? I believe we are using 4.1 VC8 from the install disk, if there are better versions or others that may work, or others that have been proven to work with VC 10 i would love to know!

I was using API 4.2 (VS2005 which is VC8) building the sample apps in VC10.


I will try 4.1 when I get into the office and let you know if that worked or not.

Original Post by: TedLai Thu Aug 4 18:58:58 2011


I just tried to build the samples that come with OpenFlight API 4.1 using Visual Studio 2010, and I experienced linker problems as well. We will look into it further at the Presagis office, and we will let you know if we are able to resolve this issue.

Original Post by: KentNichols Thu Aug 4 19:17:21 2011


With all the Electronic Delivery push, we do not have install media for 4.2 ( I'd really like to keep getting at least one DVD per major version release) so I'll have to try to find the 4.2 API in the downloads. I don't always have the best of luck ....

Login to post a comment