freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Thu Apr 19, 2018 1:52 pm
Board index » MXF Categories » freeMXF.org Tools



Post new topic Reply to topic  [ 7 posts ] 
Author
Search for:
Message

Offline
Rookie

Joined: Tue Feb 09, 2010 4:12 pm
Posts: 2

Post Posted: Tue Feb 09, 2010 4:18 pm 
Top  
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?

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Wed Feb 10, 2010 9:15 am 
Top  
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?

 Profile WWW  

Offline
Rookie

Joined: Tue Feb 09, 2010 4:12 pm
Posts: 2

Post Posted: Wed Feb 10, 2010 12:09 pm 
Top  
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.

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Fri Feb 12, 2010 9:31 am 
Top  
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!

 Profile WWW  

Offline
Board User

Joined: Tue Mar 09, 2010 12:30 pm
Posts: 8
Location: Poland, Poznan

Post Posted: Tue Mar 09, 2010 3:44 pm 
Top  
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);

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Wed Mar 10, 2010 11:03 am 
Top  
The error(), warning() and debug() functions need to be supplied by your application.

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

 Profile WWW  

Offline
Board User

Joined: Tue Mar 09, 2010 12:30 pm
Posts: 8
Location: Poland, Poznan

Post Posted: Wed Mar 10, 2010 12:03 pm 
Top  
It was built successfully.
Thank you very much.
I searched any instruction how to make it but I didn't find anything.

 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

Jump to:  


Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC