Log in

View Full Version : Noob: syntax error with avisynth.h. Help please.


Gerard V
2nd August 2006, 04:06
Hi

I'm seeking help with a noobish problem. I'm stepping through the process of learning to write my own avisynth plugins.

I've started with the simple task of making the simplesample filter work on my system, but I'm getting a syntax error in avisynth.h when compiling simplesample using Visual Studio C++ 2003 (full version)

The error is as follows:

Compiling...
GVtest1.cpp
c:\Documents and Settings\Gerard\My Documents\Visual Studio Projects\GVtest1\avisynth.h(321) : error C2059: syntax error : 'string'
c:\Documents and Settings\Gerard\My Documents\Visual Studio Projects\GVtest1\avisynth.h(321) : error C2091: function returns function
c:\Documents and Settings\Gerard\My Documents\Visual Studio Projects\GVtest1\avisynth.h(321) : error C2802: static member 'operator new' has no formal parameters

Build log was saved at "file://c:\Documents and Settings\Gerard\My Documents\Visual Studio Projects\GVtest1\Debug\BuildLog.htm"
GVtest1 - 3 error(s), 0 warning(s)

The version of avisynth.h is one of the three that come in the source tree for the current production version of avisynth which I downloaded from Sourceforge a few days ago. (Why are there 3 versions?), but the error occurs with all three versions. Am I doing something wrong, or am I using the wrong avisynth.h?

I have searched this topic but no joy. Any help gratefully received.

Guest
2nd August 2006, 04:22
Best to show us the source because I just looked at the avisynth.h in 2.5.6a and line 321 is a blank line.

Gerard V
2nd August 2006, 05:39
Best to show us the source because I just looked at the avisynth.h in 2.5.6a and line 321 is a blank line.

Good point.

I opened avisynth.h in visual studio and used goto to take me to line 321. It is the last line in this code (starts void*) in what I think is the class definition for videoframe:

VideoFrame(VideoFrameBuffer* _vfb, int _offset, int _pitch, int _row_size, int _height);
VideoFrame(VideoFrameBuffer* _vfb, int _offset, int _pitch, int _row_size, int _height, int _offsetU, int _offsetV, int _pitchUV);

void* operator new(unsigned size);

I checked with the debugger and it too takes me to that line.

IanB
2nd August 2006, 12:34
@Gerard V,

Sorry, the current versions of Avisynth are only compatible with VC6 sp4 with the Processor Pack. You will need to do some minor surgury on the source for use with VC.net. See the Compiling Thread in the stickey section for hints on VC2003 usage.

Si
3rd August 2006, 12:22
Try using this (http://www.geocities.com/siwalters_uk/avisynth.h) version .

I believe its the original 2.5 one but I can't remember - I just know it works on my setup (tried it today with SimpleSample 1.5a)

You might want to look at this (http://forum.doom9.org/showthread.php?t=106804) thread and see if my initial probs relate to yours at all.

regards
Simon

Gerard V
3rd August 2006, 18:24
Thanks Si. I had wanted to try that option. But your version of the file gives me the same error message but the line number is a little different.

I have searched the threads but have yet to find a way forward. I don't even understand the error message enough to just fix it.

I'm looking to see if I can source a legacy VC6 to see if the error occurs there too.

Gerard V
4th August 2006, 10:24
Well, if the referenced threads held a solution is wasn't obvious to me after much searching. Anyway I have attempted to solve the problem by identifying the exact nature of the syntax error.

While doing so I commented out the offending line, and that fixed it, so far. So I am apparently now able to compile filters for avisynth in VC 2003.

I'm reporting this in case someone else later comes along and has the same problem I did.

The simplesample filters now appear to work perfectly without the line commented out of avisynth.h.

Wilbert
4th August 2006, 19:58
While doing so I commented out the offending line, and that fixed it, so far. So I am apparently now able to compile filters for avisynth in VC 2003.
Which line is it?

Gerard V
5th August 2006, 03:21
It was line 321, which reads:
void* operator new(unsigned size);

Fizick
5th August 2006, 08:31
may be, somewhat is wrong in the your order of "include" pathes in VS settings? (Platform SDK, etc)

Gerard V
5th August 2006, 23:17
Thanks Fizick. You are correct. I had had to uninstall and reinstall various VS releases to get to the point I had gotten to. For the last install I had omitted to sort the include path order for SDK includes. Once I fixed that all was fine. Thanks for the tip. We're up and running now without commenting out the line in question.

Fizick
5th August 2006, 23:29
Now we waiting for your plugins :)

squid_80
6th August 2006, 10:17
For the record VS2005 complains about that line too, I forget the exact text but it is something along the lines of "First parameter to operator new must be of type size_t". Pretty obvious how to fix it:
void* operator new(size_t);Then change the actual function in avisynth.cpp to match.

Si
6th August 2006, 20:15
For the record VS2005 complains about that line too

I use VC++ 2005 Express Edition and the standard avisynth.h (V2.5) worked for me once I'd got the include paths right too :)

Do your plugins work with the modifications?

regards

Simon

foxyshadis
7th August 2006, 00:26
I don't think plugins ever actually use new Videoframe, the ones I know of use NewVideoFrame instead. If it's internal only it shouldn't hurt compatibility (though ABIs are weird...). It probably complains for squid_80 because on 64 bit, unsigned is no longer the same as size_t. =p

squid_80
7th August 2006, 07:55
Yeah, 'cause it's likely I'll want to use a data structure that's over 4gb in size :p