Playing cutscenes in c++ - c++

I'm using SDL for opening a window and handeling events. And OpenGL to render my objects to the screen. SDL_mixer for sound, and SDL_ttf for text. Now I'm trying to figure out how to be able to put a video on display. Like an animated logo or something before the game starts. Just to experiment with it. At some point I will need to know it...
I've found and tried installing FFMPEG, I've included the "include" folder, and set the "lib" folder. At first I got an error telling me it was unable to load "inttypes.h". So I downloaded a package with that and put it in the include folder for FFMPEG.
Now I'm stuck with this error, which I can't seem to be able to solve.
c:\program
files\ffmpeg-20140507-git-4cdea92-win64-dev\include\libavutil\common.h(87):
fatal error C1004: unexpected end-of-file found
And another question, is there other libraries aviable that may be easier to use for displaying a simple video? I read something about SDL being able to do it, but nothing was to be found about it.
EDIT: Here is line 78 to 96:
#if FF_API_AV_REVERSE
extern attribute_deprecated const uint8_t av_reverse[256];
#endif
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
#endif
/* Pull in unguarded fallback defines at the end of this file. */
#include "common.h"
#ifndef av_log2
av_const int av_log2(unsigned v);
#endif
#ifndef av_log2_16bit
av_const int av_log2_16bit(unsigned v);
#endif

Wrap your #include <libav*.h>s inside a block like this:
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#define UNDEFINE_STDC_CONSTANT_MACROS
#endif
extern "C"
{
#include <libavdevice/avdevice.h>
#include <libavdevice/version.h>
}
#ifdef UNDEFINE_STDC_CONSTANT_MACROS
#undef __STDC_CONSTANT_MACROS
#endif
There's probably a way around using the UNDEFINE_STDC_CONSTANT_MACROS hack but the logic just isn't coming to me right now.
Worked for me on VS2012 using Zeranoe's 32-bit ffmpeg development binaries and msinttypes' inttypes.h.

Hmm, I found the DLL-files, and it gave me a linker error with the 64-bit library.
I changed back to 32-bit and the 32-bit dlls and it worked fine. I guess that libraries ask if you have 32/64-bit Visual Studio insteath of Windows.

Related

C2014 error when adding stb_image to visual studio project

I am planning on using the library stb_image by Sean Barrett to load images into a graphics application. Lib code at the repository below:
https://github.com/nothings/stb/blob/master/stb_image.h
Though its documentation is short and clear for me in terms of adding the header stb_image.h to your project, and then:
Do this:
#define STB_IMAGE_IMPLEMENTATION
before you include this file in *one* C or C++ file to create the implementation.
// i.e. it should look like this:
#include ...
#include ...
#include ...
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
when I build it on VS2013, the compiler throws the following error:
Error 1 error C2014: preprocessor command must start as first nonwhite space c:\users\ed\desktop\opengl\stbi\stb_image.h 2318 1 STBI
...
At the beginning, I thought it was it was a line ending problem (Win32 LF, Linux CR LF), but it seems not to be.
Any hints of what might be causing this error is welcome !

Can't compile dll from C++ project - Visual Studio

I'm trying to play a RTSP stream in Unity 5.
For that I found a RTSP-plugin for Unity on Github that I want to try, but unfortunatelly it comes with no Readme or installation guide whatsoever.
So far I found out that I'm dealing with a C++ Visual Studio project that needs to be compiled into a DLL in order to add it to Unity. But when I try to build the project I get the following Error for the header file "ffmpegenv.h":
Error C1083 Cannot open include file: 'libavutil\opt.h': No such file or directory - (Screenshot)
Here's the code from the header file
#pragma once
//=============================
// Includes
//-----------------------------
// FFMPEG is writen in C so we need to use extern "C"
//-----------------------------
extern "C" {
//#define INT64_C(x) (x ## LL)
//#define UINT64_C(x) (x ## ULL)
#include <libavutil\opt.h>
#include <libavutil/mathematics.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libswresample/swresample.h>
#include <libavutil/imgutils.h>
#include <libavcodec/avcodec.h>
}
I'm aware that the header includes source code from the FFmpeg libraries which doesn't come with the plugin I'm trying to compile. So I downloaded the FFmpeg source code from their GitHub page and copied all the code files (with its original folder structure) inside the plugin's project folder.
However when I then try to compile the plugin, it still doesn't find the #includes an shows the same error as mentioned above.
How I can I get the plugin to compile? What am I missing?
Thanks in advance
P.S.: I'm using Visual Studio Community 2017 with C++ support and Win 10 SDK as well as Win 8.1 SDK.

Hello World MQTT program in mbed

Was just testing a simple hello world mqtt program on my mbed board and I keep getting this error:
Error: Cannot open source input file "fsl_enet.h": No such file or directory in "EthernetInterface/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h", Line: 33, Col: 23.
Error
I even tried fixing the error by doing what the compiler suggests by adding mbed-dev library, but the error is still there.
#ifndef K64F_EMAC_CONFIG_H__
#define K64F_EMAC_CONFIG_H__
#include "fsl_enet.h"
#define ENET_RX_RING_LEN (16)
#define ENET_TX_RING_LEN (8)
#define ENET_ETH_MAX_FLEN (1522) // recommended size for a VLAN frame
#if defined(__cplusplus)
extern "C" {
#endif
int phy_link_status(void);
#if defined(__cplusplus)
}
#endif
#endif // #define K64F_EMAC_CONFIG_H__
Looks like the EthernetLibrary was broken recently for K64F. If you import https://developer.mbed.org/teams/mqtt/code/HelloMQTT/, and choose NOT to update libraries it compiles fine for K64F.
thanks for reporting. The tools scripts were not updated (+ mbed lib), which caused this breakage in the ethernet library. Because ethernet lib requires some new KSDK files which are not yet available.
The next mbed SDK release is tomorrow, which should fix this. In the meantime, we will look at this, to find better solution - for instance to move the target code in the lwip/arch into HAL. I'll have a look today.

C++ project build, but IDE shows error

Error: cannot open source file "GL/glew.h"
I have the following code :
//Include GLEW
#include <GL/glew.h>
//Include GLFW
#include <GLFW/glfw3.h>
//Include the standard C++ headers
#include <stdio.h>
#include <stdlib.h>
//Define an error callback
static void error_callback(int error, const char* description)
{
...
I took from there: http://www.41post.com/5178/programming/opengl-configuring-glfw-and-glew-in-visual-cplusplus-express#part4
In order to have a somewhat portable solution, before I even started Visual Studio 2013 I created two System Environment Variable in windows.
GLEW=C:\Install\Development\C++\Framework\glew-1.10.0-win32\glew-1.10.0
GLFW=C:\Install\Development\C++\Framework\glfw-3.0.4.bin.WIN32\glfw-3.0.4.bin.WIN32
So in my project I could for instance write a additional include folder as: %GLEW%\include
As I said, it builds fine and runs fine as well.
Yet, not having intellisense behave properly is really annoying.
How to fix it?
My syntax was actually wrong, you cant use global environment variable in VS using %<name>% but you have to use $(%<name>).
Wherever I wrote %GLEW%\include I should have $(GLEW)\include.
It's working fine now.
Though I'm completely clueless why it built.
This post: https://stackoverflow.com/a/11543754/910813 got me to remind that.

Installing PNGwriter library in codeblocks

I'm trying to setup pngwriter library in codeblocks for c++. I've used this tutorial (http://www.neuron-hub.com/2011/06/setting-up-pngwriter-with-code.html) but something isn't working. I'm almost a beginner at c++, and those library installs are killing me.
When I build it like it says in tutorial, in codeblocks opens another tab called ft2build.h and says
#ifndef __FT2_BUILD_UNIX_H__
#define __FT2_BUILD_UNIX_H__
/* `<prefix>/include/freetype2' must be in your current inclusion path */
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_UNIX_H__ */
/* END */
so the question is does anybody know what the problem is here? Tutorial is simple and I repeated it at least 20 times and the result is the same.
You must include ..\include\freetype2\ into the path where Codeblocks searches for necessary headers.