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
[libbladeRF] Header issue in Windows #347
Comments
Hi there, I'm not seeing any build issues for 32-bit or 64-bit builds in Visual Studio 2010 and 2012. Could you share a bit more info about your setup? Could you point out the specific line here (like this) and share the compilation failure message(s)? Thanks! |
Hi, The problem is not compiling the source code itself (I use the precompiled version). But when I create my own project with Visual Studio 2012 C++ and try to include “libbladerf.h” I get the following error:
From: Jon Szymaniak [mailto:notifications@github.com] Hi there, I'm not seeing any build issues for 32-bit or 64-bit builds in Visual Studio 2010 and 2012. Could you share a bit more info about your setup? Could you point out the specific line here (like thishttps://github.com/Nuand/bladeRF/blob/5cd6422db756e810a0359ee7523b512be25dc148/host/libraries/libbladeRF/include/libbladeRF.h#L27) and share the compilation failure message(s)? Thanks! — |
My apologies, I realized I misunderstood your problem statement. MSVC still supports a bool type, so ifdef'ing out that inclusion of stdbool.h line suffices then? (This doesn't result in any strange issues with respect to the size of the return value?) As a temporary workaround, you could pull in this stdint.h header. |
To elaborate a bit more on my question. The prebuilt DLL is using the stdint.h mentioned, where sizeof(bool) == sizeof(int). To my knowledge the standards define sizeof(bool) to be implementation-defined (please correct me if I'm wrong). If instead of using the stdint.h header linked above, we ifdef that line out, are we certain that the size of the bool values used by the user's compiler (i.e., whatever bool is without our stdint.h) will be the same as those built in with the DLL (as these are used as return values and fn parameters)? Without stdint.h, MSVC still supports bool? That would surprise me, and I'll go check later. For that concern, I'm leaning toward addressing this by shipping our stdint.h along with libbladeRF.h. I'd appreciate any additional feedback and thoughts you have on this. Thanks! |
"Without stdint.h, MSVC still supports bool? That would surprise me, and I'll go check later." That is correct. There is no definition for type 'bool' inside stdint.h. |
While MSVC supports bool for C++ code as you noted above, it doesn't appear to for C code (which makes sense given that it leans towards C89). So it looks like we can ifdef that out for C++ code, as you noted. If folks are compiling C code in Visual Studio 2012 or earlier, they'll just have to pull in our stdint.h, which we can ship with the installer from now on. (We'll recommend VS2013 for C users, which is already on the build instructions.) I see that with MSVC, sizeof(bool) == 1. Therefore our stdint.h header is wrong, and that will have to get fixed as well. Does this sound reasonable? I'll look to have something in a dev branch soon for your review. |
The requested conditional removal of I've made some changes to hopefully help avoid the situation that caused this to go unnoticed for so long. Thanks again, @bpssoft. Tomorrow I'll verify that this doesn't break things in other build environments and do some additional testing. If folks really want, I can have a new installer generated and made available. Otherwise, a new one will be up at the release at the end of the month. |
@jynik Thank you very much for your effort! The solution works as expected. I'm really happy to work with bladeRF! Thank you so much for your support |
Merged into master in 7706e92. Removed temporary dev branch. |
The header file 'libbladerf.h' contains the following line: #include <stdbool.h>
Visual Studio will fail if you are using this header because of the #include <stdbool.h> line.
Can you try to move it inside a #if statement?
The text was updated successfully, but these errors were encountered: