Problem with theora on cygwin

Pages: 12
Hello,
I installed the ogg's librairy.
I installed the théora's library.
In the firsts steps of encoding, I success to declare the _info struct. But I don't success to declare the th_encode_alloc().

My code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <theora/theoraenc.h>
#include <theora/theoradec.h>
using namespace std;

int main()
{

	th_info *info;
	info->frame_height = 16;
	info->frame_width = 16;
	info->pic_height = 16;
	info->pic_width = 16;
	info->pic_x = 0;
	info->pic_y = 0;
	info->colorspace=TH_CS_UNSPECIFIED;
	info->pixel_fmt=TH_PF_420;
	info->target_bitrate=10;
	info->quality=50;
	info->keyframe_granule_shift=0;
	th_encode_alloc(info);
	return 0;
}

I need help. Thanks.
Did you link libtheoraenc and libtheoradec like it says to do right here?: http://www.theora.org/doc/libtheora-1.0/group__encfuncs.html
Line 8 declares a pointer to a th_info object. The pointer is left uninitialized and subsequently dereferenced in the following lines. I'm guessing you're missing a call to initialize info (maybe line 20 or something similar).
moorecm seems to be right. You initialized a pointer to nothing, assigned if values which went no where and tried passing it to a function. Good eye moorecm
1
2
#include <theora/theoraenc.h>
#include <theora/theoradec.h> 


It's the libtheoradec and libtheoraenc, is'nt ?
I don't understand, when I write " th_encode_alloc(info);", the error is "undefined reference to '_th_encode_alloc', and when I write "th_encode_alloc();", the error is "to few arguments to function
'th_encode_ctx* th_encode_alloc(const th_info*)'". Please help me!
So you aren't actually linking with the libraries--just including the headers?
Why link the librairy and not just the headers ?
The headers don't necessarily contain definitions for the functions, they may just contain prototypes. The libraries will contain the actual function definitions.
Is it for me to create librairy ?
You don't create the libraries (at least not this one) you download the library and link it in the when the program compiles by either manually editing the makefile or doing so in your IDE
I use g++, what the complement of this command "g++ main.cpp -o prog.exe" for integrate the libtheora ?

I list files that I found :

/usr/local/lib/libtheora.a
/usr/local/lib/libtheora.la
/usr/local/lib/libtheoraenc.a
/usr/local/lib/libtheoraenc.la
/usr/local/lib/libtheoradec.a
/usr/local/lib/libtheoradec.la
/usr/include/theora/theora.h
/usr/include/theora/theoraenc.h
/usr/include/theora/theoradec.h


Thanks.
I would try this first:
g++ main.cpp -o prog.exe -ltheora -ltheoradec -ltheoraenc

If that works, try to narrow it down to using the least of the libraries as the application requires.
Last edited on
I test but it cannot find -ltheora, -ltheoradec, and -ltheoraenc. Thanks to continue to help me.
Ok, try adding the library path:
g++ main.cpp -o prog.exe -L/usr/local/lib -ltheora -ltheoradec -ltheoraenc
already test but does not.
So it does not compile? Could you post the command line and error messages?
.... ld: cannot find .... for the three -l....
I have an other error !!!

I used this command
g++ main.cpp -o prog.exe -L/lusr/lib/theoraenc.a -L/lusr/lib/theoradec.a -L/lusr/lib/theora.a

No "cannot find" but :
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../libcygwin.a(libcmain.o):(.text+0xa9): undefined reference to 'WinMain@16'
collect2: ld returned 1 exit status


http://c.developpez.com/faq/?page=divers_def#DIVERS_WinMain
The reason is incoherent with my case.

I don't understand. Thanks for help.
Oh sorry, forget the las post. I continue my research.
Pages: 12