Linking Error with MSVC++ 6.0

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking Error with MSVC++ 6.0

Sukhbir Singh

Hi All,

While intergrating FFMpeg static libs with my own code written in c++ using MSVC++ 6.0,
I am getting following linking error:
libmingwex.a(pformat.o) : error LNK2001: unresolved external symbol __get_output_format

Please help me out.
I will appreciate your efforts.

With regards
Sukhbir


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Keith Marshall
On Thursday 22 January 2009 17:02:42 Sukhbir Singh wrote:
> While intergrating FFMpeg static libs with my own code written in
> c++ using MSVC++ 6.0,

First, a plug for free software: had you chosen to build your entire
application using MinGW, instead of using this outdated, proprietary,
non-free and restrictively licensed compiler suite, then you would
never have encountered...

> I am getting following linking error:
> libmingwex.a(pformat.o) : error LNK2001: unresolved external symbol
> __get_output_format

...this error.

Ok.  This probably isn't the answer you hoped for, so here is the
authoritative answer I promised, when I responded to your earlier
post to MinGW-MSYS.

  int _get_output_format( void );

is a standard MSVC function, but it was not introduced until VS-2005;
therefore, there is no implementation provided by VC-6.0.  To support
users of more recent MSVC, (with MSVCRT version >= 8.00), who might
also wish to use the _set_output_format() feature, and who also wish
to use MinGW's enhanced printf() implementation, (which is what uses
pformat.o), a call to _get_output_format() is needed.  To satisfy
that requirement, when linking against earlier MSVCRT versions,
MinGW's own import libraries provide a stub implementation of this
function, which isn't provided by Microsoft's own libraries.  Thus,
you need to provide your own stub; add:

  int _get_output_format( void ){ return 0; }

as a global function definition, to the source which provides your
main() function, when you must use non-MinGW libraries, for linking
to MSVCRT versions predating msvcr80.dll.

--

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Sukhbir Singh
Hi Keith,
 
 Thanks for you reply.
 I did everything that you have mentioned in your last mail.
 i have globaliy defined the _get_output_format function in my code.
 But still i am getting same linking error.
 About msvcr80.dll, i did not get you.
 Please help me out.
 
With Regards,
Sukhbir 

On Fri, Jan 23, 2009 at 1:30 AM, Keith Marshall <[hidden email]> wrote:
On Thursday 22 January 2009 17:02:42 Sukhbir Singh wrote:
> While intergrating FFMpeg static libs with my own code written in
> c++ using MSVC++ 6.0,

First, a plug for free software: had you chosen to build your entire
application using MinGW, instead of using this outdated, proprietary,
non-free and restrictively licensed compiler suite, then you would
never have encountered...

> I am getting following linking error:
> libmingwex.a(pformat.o) : error LNK2001: unresolved external symbol
> __get_output_format

...this error.

Ok.  This probably isn't the answer you hoped for, so here is the
authoritative answer I promised, when I responded to your earlier
post to MinGW-MSYS.

 int _get_output_format( void );

is a standard MSVC function, but it was not introduced until VS-2005;
therefore, there is no implementation provided by VC-6.0.  To support
users of more recent MSVC, (with MSVCRT version >= 8.00), who might
also wish to use the _set_output_format() feature, and who also wish
to use MinGW's enhanced printf() implementation, (which is what uses
pformat.o), a call to _get_output_format() is needed.  To satisfy
that requirement, when linking against earlier MSVCRT versions,
MinGW's own import libraries provide a stub implementation of this
function, which isn't provided by Microsoft's own libraries.  Thus,
you need to provide your own stub; add:

 int _get_output_format( void ){ return 0; }

as a global function definition, to the source which provides your
main() function, when you must use non-MinGW libraries, for linking
to MSVCRT versions predating msvcr80.dll.

--

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Benjamin Riefenstahl
Hi Sukhbir,


>> On Thursday 22 January 2009 17:02:42 Sukhbir Singh wrote:
>> > While intergrating FFMpeg static libs with my own code written in
>> > c++ using MSVC++ 6.0,

Keith Marshall wrote:
>>  int _get_output_format( void ){ return 0; }
>>
>> as a global function definition, to the source which provides your
>> main() function, when you must use non-MinGW libraries, for linking
>> to MSVCRT versions predating msvcr80.dll.

Sukhbir Singh writes:
>  i have globaliy defined the _get_output_format function in my code.
>  But still i am getting same linking error.

You mention that you write C++.  In a C++ file that function would
need to have an 'extern "C"' added to make it compatible with C.  So
that would make:

  extern "C" int _get_output_format( void ){ return 0; }


benny

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Keith Marshall
On Saturday 24 January 2009 16:49:55 Benjamin Riefenstahl wrote:
> Sukhbir Singh writes:
> >  i have globaliy defined the _get_output_format function in my
> > code. But still i am getting same linking error.
>
> You mention that you write C++.  In a C++ file that function would
> need to have an 'extern "C"' added to make it compatible with C.
>  So that would make:
>
>   extern "C" int _get_output_format( void ){ return 0; }

Indeed.  Thanks Benny; I overlooked that little wrinkle in my original
reply, perhaps because I rarely write C++.

Another wrinkle: if you write it instead, as

  extern "C" int _get_output_format( void ){ return 1; }

you will get ISO C99 conformant 2-digit exponents, rather than the
Microsoft non-conformist 3-digits, in the "%e" and "%g" formats, when
your application calls any of the MinGW enhanced printf() functions.
(However, adding PRINTF_EXPONENT_DIGITS=2 to your environment remains
the preferred way to achieve this).

--

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Keith Marshall
In reply to this post by Sukhbir Singh
On Friday 23 January 2009 15:08:42 Sukhbir Singh wrote:
>  About msvcr80.dll, i did not get you.
>  Please help me out.

msvcr80.dll is the version of Microsoft's C runtime library first
published to accompany VS-2005, IIRC.  You will have an earlier
version with your MSVC-6.0, and that version, compatible with the
msvcrt.dll used as default by MinGW, lacks the _get_output_format()
function, which first appeared in msvcr80.dll.

MinGW's enhanced printf() functions include support for the 2-digit
exponent capability, also introduced in msvcr80.dll.  That means that
our printf() functions need to call _get_output_format(), and to make
that possible, even with the earlier MSVCRT versions, we add a stub
to *our* import libraries for those older DLL versions.  Of course,
Microsoft's implementations of those import libraries provide no
such "forward compatibility" support.

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: Linking Error with MSVC++ 6.0

Sukhbir Singh
In reply to this post by Benjamin Riefenstahl
Thanks for your support

On Sat, Jan 24, 2009 at 10:19 PM, Benjamin Riefenstahl <[hidden email]> wrote:
Hi Sukhbir,


>> On Thursday 22 January 2009 17:02:42 Sukhbir Singh wrote:
>> > While intergrating FFMpeg static libs with my own code written in
>> > c++ using MSVC++ 6.0,

Keith Marshall wrote:
>>  int _get_output_format( void ){ return 0; }
>>
>> as a global function definition, to the source which provides your
>> main() function, when you must use non-MinGW libraries, for linking
>> to MSVCRT versions predating msvcr80.dll.

Sukhbir Singh writes:
>  i have globaliy defined the _get_output_format function in my code.
>  But still i am getting same linking error.

You mention that you write C++.  In a C++ file that function would
need to have an 'extern "C"' added to make it compatible with C.  So
that would make:

 extern "C" int _get_output_format( void ){ return 0; }


benny

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming