where is sscanf_s? - c++

sscanf_s is undefined on my system. The definition is not included in any of the stdio.h files I have from various SDKs. I searched all files on my system for this.
I have microsoft visual c++ 6.0
what is the proper .h file and library and where do I get them?

sscanf_s() is a Microsoft only function, and, based on this, was introducted in VS 2005 so is not available in VS 6.0.
Either use sscanf() or upgrade your compiler.

Related

Visual Studio 2017 Android NDK math.h

I'm trying to port some OpenGL ES code from windows to Android using the Android NDK. I'm using Visual Studio 2017 and C++. What I did so far, I created a cross platform gles project in VS and removed the ios data. I'm putting one code file after the other and try to fix any errors I can find.
The issue I have is that is seems that math.h functions can't be found.
Here's some information that might be relevant:
Platform toolset is clang 3.8
Target API Level is android-21
Language standard is c++11
I have added m; as an option to linker library dependencies
If i include math.h I get:
use of undeclared identifier 'sqrt' (and all the other math.h functions I'm using)
If i include cmath I get:
no member names 'acos' in the global namespace (and all the other cmath functions)
Path for files (as found by Visual Studio):
c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-21\arch-x86\usr\include\math.h
c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include\cmath
If I remove all math calls, it compiles.
Has anyone managed to use cmath in this context? If so, do you have any tips or point to what am I doing wrong?
Thanks.
If you #include <cmath> The methods are in std namespace so you should use std::acos etc.
I have not found a fix to the questions, but creating a project from the native android template allows you to use cmath without error, but you do need to add m; in linker input.

Visual Studio 2017, experimental/optional - No such file or directory [duplicate]

I want to use std::experimental::optional, but MSVS 2013 tells me it can't find the header.
Why isn't it there?
Can I roll my own based on code elsewhere? The C++14 proposal maybe?
std::experimental::optional originates from the Boost.Optional library, and this implementation works well in Visual C++ 12.0 (though it differs a little). Reference single-header implementation, based on the N3793 proposal paper, can be found here.
The latest list of supported C++11/14/1z core and library features that are shipped with Visual Studio can be found from the Visual C++ Team blog, from this post in particular. A set of header files of the Standard Library implementation (and some extensions) from Microsoft can be viewed here.
I've found that this implementation compiles with MSVC2013. Note that only compiles, everything else isn't guaranteed.
https://github.com/mapbox/variant/blob/master/include/mapbox/optional.hpp
I was using this one for msvc2015 and it worked:
https://raw.githubusercontent.com/akrzemi1/Optional/master/optional.hpp

Is Windows SDK always needed for including Windows.h?

I tried to use FindFirstFile WIN API function in my c program and noticed that i can use it after including Windows.h in Visual Studio 2010. I am a bit confused because i never installed the Windows SDK on that system. I thought one can only use Windows.h after installing the Windows SDK. Can someone explain to me why this is possible? Also i am wondering about the starting capital Letter of Windows.h. In the past i used windows.h. I have to do a presentation of my code on a computer with only Visual Studio 2010 installed and need to be sure that it will compile on that computer. Big thanks for any helpful information!
The Windows SDK isn't the only way to get the headers - they are also included with Visual Studio.
Visual C++ and the Windows Header Files
Microsoft Visual C++ includes copies of the Windows header files that
were current at the time Visual C++ was released. Therefore, if you
install updated header files from an SDK, you may end up with multiple
versions of the Windows header files on your computer. If you do not
ensure that you are using the latest version of the SDK header files,
you will receive the following error code when compiling code that
uses features that were introduced after Visual C++ was released:
error C2065: undeclared identifier.
Source: http://msdn.microsoft.com/en-gb/library/windows/desktop/aa383745(v=vs.85).aspx)

Is it possible to compile ffmpeg in visual studio 2010?

Is it possible to compile the sourcecode from ffmpeg in visual studio 2010? Is it difficult?
Just looking for some advice (and instructions) if possible. :-)
Cheers,
Pete
Apparently someone at Google has written a C99 to C89 "downconverter" in part to get ffmpeg to compile with Visual Studio:
http://blogs.gnome.org/rbultje/2012/09/27/microsoft-visual-studio-support-in-ffmpeg-and-libav/
The tool they wrote is currently only in source code form. Although that tool is written in C, it uses some compiler specific includes, specific to the Clang compiler, so you currently need clang to compile it. I had to get all the pieces to Clang (which relies on llvm) and compile with VS2010. OK, got that figured out, so now I have the two tools compiled: c99wrap.exe and c99conv.exe.
The blog does not mention two important things that are mentioned here:
http://libav.org/platform.html#Microsoft-Visual-C_002b_002b
First, you have to ensure the link.exe you use is the Visual C linker and not the mingw linker. Also, the msvc toolchain under msys does not yet support shared DLL builds, it only supports static lib builds at this time, so --enabled-shared fails to link.
It is not possible because ffmpeg makes extensive use of C99 features (with good reason), and MSVC doesn't support nearly enough nook and crannies of the standard.
You can however, use the C library built by MinGW for use with Visual Studio projects. See the following links for all the information you need:
Information about building/using the library on Windows with Visual Studio: http://ffmpeg.arrozcru.org/wiki/index.php?title=Main_Page
Downloads: http://ffmpeg.arrozcru.org/autobuilds/
Of course it is possible
To use FFmpeg SVN libraries with your Microsoft Visual C++ project,
you must first make sure your Microsoft Visual C++ build system has
the inttypes.h and stdint.h include files.
How do I know if I have those files? Well... unless you already did
this and know you have that file, you don't have it. MSVC++ does not
adhere to the C99 standard, where that file is specified, so you're on
your own here.
Alexander Chemeris was nice enough to make such files for Microsoft
Visual C++, so they can be found here
Download latest archive from link above and unpack it to the folder to
which you installed FFmpeg's include files. The default path is
/usr/local/include, which is, in this guide for Windows,
C:\msys\local\include.
Inttypes C99
Visual Studio 2013 provides the support for C99 which was missing earlier. With this ffmpeg can now be built using Visual Studio 2013. You can read more about the new language/libraries features here.
Also, try out Visual Studio 2013 RC here.
According to the documentation it is not possible.

Visual Studio 2008 Express MFC Support

As may be known by many, the Express versions of Visual Studio 2008 don't include support for MFC and a few other packages required to compile a lot of windows programs.
So, here's my problem:
I have the full version of Visual Studio 2005. I've been using this to compile a project that a friend of mine was working on, so that I could test it out for him and continue to track bugs and things. Recently, he upgraded that project to VS 2008, which I don't have. So, I downloaded the express version in the hopes that I could simply compile with that, but no luck, it complains about headers missing left and right.
It seems to me that since I already have the full version of VS 2005, I'm bound to have at least some (perhaps older) version of the files in question that his project needs to compile against.
Is there a way I can convince VS 2008 to also look in 2005's directories for include files and library files to compile against?
Furthermore, is this a bad idea? I would really prefer not to go out and purchase VS 2008 full, as I'll never use it myself. (2005 does the job fine for me at the moment, and I tend to prefer GCC anyway.)
Thanks
You can use the VC++ compiler directly from the command line, or just create a new project w/ the source in Visual Studio 2005. Unless he is using some functionality provided in the new versions of MFC/ATL in 2008/2008sp1, you should be able to compile the project just fine.
See ("Create Project from Existing Source") in Visual Studio 2005. It is unfortunate that they don't include these libraries with the Express Editions.
Use the vcvars*.bat script(s) from Visual Studio 2005. See this blogpost from VC++ Blog to see how. You will use the old compilers, but the build system from Visual Studio 2008.
You can go into Tools>Options>Projects and Solutions>VC++ Directories
and alter the Include, Library, and Source (and Reference maybe?) folders to use VC++ 2005's folders.
I'd guess you just replace $(VCInstallDir) with a hardcoded VS 2005 path. I'd record the original values before doing this.
However, have you just tried using the OLD 2005 sln and vcproj files? Keep using 2005 on your end and 2008 on his. Keep two sets of these files for each IDE. Any issues are going to be with the library mismatch - which you're not avoiding by using 2008's tools with 2005's libraries.
The simple way to deal with this would be to revert the solution and project files back to their visual studio 2005 state from source control(you are using source control right?). At this point you can compile the project as long as your friend does not use any of the mfc 9 only functions.
The first thing I would try is loading this up in VS 2005 by just modifying the version of the .sln and the .vcproj files. In the .vcproj change the version from 9.00 to 8.00 and in the .sln change the format version from 10.00 to 9.00.
If you don't have fancy stuff in the project you have a high chance of just being able to use it like this. Also this would avoid having to update 2 project and solution files.
On this website it is shown how MFC code can be compiled with the Visual Studio Express versions:
link
Just for the record, I've done that(by modifying the include directories and library directories from inside the IDE) and it's working pretty well, I have MFC, ATL, everything.
I've found this explanation. http://www.codeproject.com/Articles/30439/How-to-compile-MFC-code-in-Visual-C-Express