freeMXF.org
http://freemxf.org/forum/

Problems with MS VSE 2008 and Qt
http://freemxf.org/forum/viewtopic.php?f=2&t=190
Page 1 of 1

Author:  dmitry [ Tue Feb 09, 2010 4:18 pm ]
Post subject:  Problems with MS VSE 2008 and Qt

Hi!
I tried to compile mxflib with MS Visual Studio Express 2008 on WinXP. Compiler produced an error c2440 at line 389 in file 'helper.h', so I had to replace:
Code:
char *sep = strchr(p, PATH_SEPARATOR);

with following:
Code:
char pp = *p;
char *sep = strchr(&pp, PATH_SEPARATOR);

After that mxflib was builded succesfully and I got mxflib.lib in 'Debug' directory.
But when I tried to use it within my Qt application (I added path to the .lib file into project and path to mxflib directory as includepath) Qt (4.6.1 SDK) produced an error in file 'system.h' at line 372 because file 'config.h' does not exist. According to the comment on this line, this file is "generated by running ./configure". But how can I get it under Windows?

Author:  Matt Beard [ Wed Feb 10, 2010 9:15 am ]
Post subject: 

There appear to be two problems here.

First, it seems that VS 2008 includes a change to the way that overloaded functions are chosen. There are two versions of strchr() one takes a const char pointer for the first parameter, and returns a const char pointer, the other uses non-const pointers for both.

The code in helper.c is using a const parameter and putting the result into a non-const pointer. This causes earlier compilers to use the const version of strchr() and silently cast the result. The newer compiler seems to take account of the desired return type (which is non-const) and so uses the non-const version of strchr() - requiring a non-const first parameter.

Your fix of building a non-const pointer to pass in will work, but the better solution is to change sep to be a const pointer.

The second problem is more puzzling. The code you are having problems with in system.h, the inclusion of config.h, is inside a "#ifndef _MSC_VER" block, so should not be compiled when using any MS compiler. I think you need to investigate what is causing this - is an earlier header file doing "#undef _MSC_VER" for some reason?

Author:  dmitry [ Wed Feb 10, 2010 12:09 pm ]
Post subject: 

1. Thnx! It works.

2.
Matt Beard wrote:
The second problem is more puzzling. The code you are having problems with in system.h, the inclusion of config.h, is inside a "#ifndef _MSC_VER" block, so should not be compiled when using any MS compiler. I think you need to investigate what is causing this - is an earlier header file doing "#undef _MSC_VER" for some reason?


But my version of Qt uses MinGW compiler.

Author:  Matt Beard [ Fri Feb 12, 2010 9:31 am ]
Post subject: 

Ah!

MinGW is not specifically supported, but it should work.

You will need to use MSYS to set up an environment to run the ./configure script. This will include adding autoconf and automake. Once that is done it should work as if you are on a Linux system.

Please let me know if this works!

Author:  bernard [ Tue Mar 09, 2010 3:44 pm ]
Post subject: 

Hi, Matt.
I try to run a project with mxflib and I get a problem during linking the project.
I've got MS Visual C++ 2008 on Windows XP.

Linker returns 3 errors:

Code:
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl mxflib::error(char const *,...)" (?error@mxflib@@YAXPBDZZ) referenced in function "protected: virtual void __thiscall mxflib::RefCount<class mxflib::UL>::DeleteRef(class mxflib::ParentPtr<class mxflib::UL> &)" (?DeleteRef@?$RefCount@VUL@mxflib@@@mxflib@@MAEXAAV?$ParentPtr@VUL@mxflib@@@2@@Z)
1>mxf2Jpeg.obj : error LNK2001: unresolved external symbol "void __cdecl mxflib::error(char const *,...)" (?error@mxflib@@YAXPBDZZ)
1>D:\4k\mxf\mxfToJpeg\mxfToJpeg\Debug\mxfToJpeg01.exe : fatal error LNK1120: 1 unresolved externals


I created a mxflib.lib library, I added it to my project.
I included mxflib.lib to my header file with: #include <mxflib/mxflib.h>.
After that I can't build my project.
If I build any project from mxflib-beta-1.0.1 it ends successfully.

I tried all day, but I can't figure it out.

Could you help, please?


PS
I received an error in system.h, line 357:
Code:
else Ret += " " + std::string(OSInfo.szCSDVersion);


I had to add (LPCSTR) type casting and now it's compiled without errors. You can see it below.

Code:
else Ret += " " + std::string((LPCSTR) OSInfo.szCSDVersion);

Author:  Matt Beard [ Wed Mar 10, 2010 11:03 am ]
Post subject: 

The error(), warning() and debug() functions need to be supplied by your application.

These are used by the library to send your app messages.

Author:  bernard [ Wed Mar 10, 2010 12:03 pm ]
Post subject: 

It was built successfully.
Thank you very much.
I searched any instruction how to make it but I didn't find anything.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/