I've been trying to create some code in a program I am writing that will decode an OGG Vorbis file. I am using Dev-C++, the newest beta. When I run the compiled program on Windows, I get an error, and the program closes. Here is my code, followed by the flags used in Dev-C++.
Code:
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#include <vorbis/vorbisenc.h>
#include <gl/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <wx/msgdlg.h>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
// Create a buffer for PCM audio output
char pcmout[4096];
// Declare vorbis file global variable
OggVorbis_File OggFile;
int end = 0;
int current_section;
// Create the initialization function
void init()
{
glClearColor(1.0,1.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,675.0,500.0,0.0);
}
// Create the display function
void displayFunc()
{
// Clear the screen
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glColor3f(0.5,0.5,0.5);
glBegin(GL_LINES);
glVertex3f(15.0,15.0,0.0);
glVertex3f(30.0,50.0,0.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
// Create a playback function
void playback()
{
if(ov_open(stdin, &OggFile, NULL, 0) < 0)
{
wxMessageDialog error(NULL,wxT("Error!"),wxT("The file you specified is not in OGG Vorbis file format, or is corrupt and could not be opened."),wxOK);
error.ShowModal();
exit(1);
}
ov_clear(&OggFile);
}
// Create the main function
int main(int argc, char *argv[])
{
#ifdef _WIN32
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
fopen("YourePitiful.ogg","rb");
playback();
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowPosition(50,50);
glutInitWindowSize(675,500);
int drawWin = glutCreateWindow("Virtual Turntable Beta 1.0");
glutDisplayFunc(displayFunc);
init();
glutMainLoop();
fclose(stdin);
return 0;
}
/*
Compiler flags
-fno-rtti
-fno-exceptions
-fno-pcc-struct-return
-fstrict-aliasing
-Wall
-fvtable-thunks
-D__WXMSW__
-D__GNUWIN32__
-D__WIN95__
*/
/*
C++ Compiler flags
-fno-rtti
-fno-exceptions
-fno-pcc-struct-return
-fstrict-aliasing
-Wall
-D__WXMSW__
-D__GNUWIN32__
-D__WIN95__
-w
*/
/*
Linker flags
-lwxmsw26
-lwxmsw26_gl
-lwxtiff
-lwxjpeg
-lwxpng
-lwxzlib
-lwxregex
-lwxexpat
-lkernel32
-luser32
-lgdi32
-lcomdlg32
-lwinspool
-lshell32
-lcomctl32
-lole32
-loleaut32
-luuid
-lrpcrt4
-ladvapi32
-lwsock32
-lodbc32
-lopengl32
-lglut32
-lglu32
-lopengl32
-lgdi32
-lwinmm
-logg_d
-logg_static_d
-lvorbis_d
-lvorbis_static_d
-lvorbisenc_d
-lvorbisenc_static_d
-lvorbisfile_d
-lvorbisfile_static_d
*/
Oh, yeah, I forgot to say that I will also be using parts of wxWidgets, mainly alert boxes, and GLUT, too. Even when I try to compile the Vorbis example code, I get the same error.