Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio compile error #60

Open
leochan2009 opened this issue Aug 2, 2017 · 2 comments
Open

Visual Studio compile error #60

leochan2009 opened this issue Aug 2, 2017 · 2 comments

Comments

@leochan2009
Copy link

Hi,
i am trying to compile the project on my windows 7 machine.
I have the following configuration:
Environment: Toolset=v140; Configuration: Debug; Platform: x86
However, i got the following error:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1421): fatal error C1189: #error: Macro definition of vsnprintf conflicts with Standard Library function declaration [C:\projects\openigtlink\build\Deps\openHEVC-bin\LibOpenHevcWrapper.vcxproj] [C:\projects\openigtlink\build\openHEVC.vcxproj]

I could fix the error by deleting the vsnprintf definition in CmakeLists file, showed as below:
if(WIN32)
add_definitions(
-Dsnprintf=avpriv_snprintf
-Dvsnprintf=avpriv_vsnprintf
-Dinline=__inline
-Drestrict=__restrict
)
endif()

Do you have a general solution for this problem?

Another issue is the function:
static attribute(always_inline)) inline ...................
This function also create error in compiling
after deleting the attribute(always_inline)) , the compiling succeeded.

Your kind answer to my questions would be greatly appreciated.

Best Regards,
Chan

@pcabarat
Copy link
Collaborator

pcabarat commented Aug 16, 2017

Hi,
Thanks for reporting,
We use some compatibiliy macros for multiplatform into compat/ directory. You can have a look to compat/msvcrt/snprintf.h and see where does this problem comes from.
Those were taken from ffmpeg and haven't been updated for a while.
We usually use crossplatform build in order to test for windows, so build might be broken on visual studio.
I'll try to have a look into this when I'll have some time for it.

Concerning the second issue, i'll need a bit more details to solve your problem, since we already have an inline after the always_inline attribute I believe deleting it should be ok. I don't know how to force inlining into visual studio (always_inline is a gcc option). You might like replacing the
static attribute(always_inline)) inline
by
static av_always_inline
This should do the trick.
Where is this function located so I can fix it ?

Pierre-Loup

@leochan2009
Copy link
Author

Hi Pierre-Loup,

Thanks for your reply.
I tested several H265 decoders (openHEVC libde265, and JCT-VC ) for real time decoding purpose. The decoding speed varies a lot, and openHEVC is the fastest implementation the fastest implementation. So I really would like to include this great library into my open source project.
It would be really helpful if it works on multi-platforms (which is sometimes very hard...)

Yes, av_always_inline will do the trick, i tested in my visual studio 2015.
The line is located in the \libavcodec\x86\hevc_sao_sse.c file. line 338

Thanks again,
Best Regards,
Longquan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants