[Stk] Newbie Compile Errors

Chris Share cshare01@qub.ac.uk
Mon, 18 Jul 2005 17:06:22 +0100


Hi,

If I comment out the following (in valarray):

	/*_Ty min() const
		{	// return smallest of all elements
		_Ty _Min = _Myptr[0];
		for (size_t _Idx = 0; ++_Idx < size(); )
			if (_Myptr[_Idx] < _Min)
				_Min = _Myptr[_Idx];
		return (_Min);
		}

	_Ty max() const
		{	// return largest of all elements
		_Ty _Max = _Myptr[0];
		for (size_t _Idx = 0; ++_Idx < size(); )
			if (_Max < _Myptr[_Idx])
				_Max = _Myptr[_Idx];
		return (_Max);
		}*/

my code compiles.

Will this cause any problems?

Cheers,

Chris

Immanuel Litzroth wrote:
> I looked at the output and this might be an issue where windows defines
> max and min as macros, so call to std::max and std::min are macroexpanded 
> and problematic.
> Immanuel
> 
> "Gary P. Scavone" <gary@music.mcgill.ca> writes:
> 
> 
>>Hi Chris,
>>
>>VS2003 seems to be having a problem with the valarray include
>>statement in Stk.h.  But my guess is that these errors might go away
>>if you compile for "release" instead of "debug".  I don't know why,
>>but there always seem to be problems with "debug" compiles with
>>Windoze.
>>
>>Just another note ... make sure to use the __LITTLE_ENDIAN__
>>preprocessor definition with WvIn.
>>
>>Regards,
>>
>>--gary
>>
>>On Jul 18, 2005, at 11:14 AM, Chris Share wrote:
>>
>>
>>
>>
>>
>>
>>
>>>Hi,
>>>
>>>I'd like to use STK for some research work that I'm currently doing.
>>>
>>>I'm using Microsoft VS2003 on Windows XP.
>>>
>>>I thought that I'd start by writing a simple app that reads a .wav
>>>file however I'm getting errors while trying to use WvIn.h. The
>>>problem arises as soon as I include WnIn.h.
>>>
>>>Here are the errors that I'm getting:
>>>
>>>------ Build started: Project: Waveguide_01, Configuration: Debug
>>>Win32 ------
>>>
>>>Compiling...
>>>Waveguide_01Dlg.cpp
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : warning C4003: not enough actual parameters for
>>>macro 'min'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(323) : warning C4003: not enough actual parameters for
>>>macro 'max'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2059: syntax error : ')'
>>>        c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
>>>\include\valarray(427) : see reference to class template
>>>instantiation 'std::valarray<_Ty>' being compiled
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ';' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2238: unexpected token(s) preceding ';'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(323) : error C2146: syntax error : missing ';' before
>>>identifier '_Ty'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2059: syntax error : ')'
>>>        c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
>>>\include\valarray(1124) : see reference to class template
>>>instantiation 'std::valarray<_Ty>' being compiled
>>>        with
>>>        [
>>>            _Ty=size_t
>>>        ]
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(323) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing ';' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2238: unexpected token(s) preceding ';'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(332) : error C2146: syntax error : missing ';' before
>>>identifier 'valarray'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2059: syntax error : ')'
>>>        c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
>>>\include\valarray(1333) : see reference to class template
>>>instantiation 'std::valarray<_Ty>' being compiled
>>>        with
>>>        [
>>>            _Ty=std::_Bool
>>>        ]
>>>        c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
>>>\include\valarray(1335) : see reference to class template
>>>instantiation 'std::mask_array<_Ty>' being compiled
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ';' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2238: unexpected token(s) preceding ';'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(323) : error C2146: syntax error : missing ';' before
>>>identifier '_Ty'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2059: syntax error : ')'
>>>        c:\Documents and Settings\Chris.LAPTOP\Desktop\Programming
>>>Work\Waveguide\Waveguide_01\stk\include\Stk.h(226) : see reference
>>>to class template instantiation 'std::valarray<_Ty>' being compiled
>>>        with
>>>        [
>>>            _Ty=StkFloat
>>>        ]
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(314) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(321) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(323) : error C2334: unexpected token(s) preceding ':';
>>>skipping apparent function body
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing ')' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing '}' before ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2059: syntax error : ')'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2143: syntax error : missing ';' before '}'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(330) : error C2238: unexpected token(s) preceding ';'
>>>c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
>>>\valarray(332) : error C2146: syntax error : missing ';' before
>>>identifier 'valarray'
>>>
>>>Build log was saved at "file://c:\Documents and Settings
>>>\Chris.LAPTOP\Desktop\Programming Work\Waveguide\Waveguide_01\Debug
>>>\BuildLog.htm"
>>>Waveguide_01 - 40 error(s), 2 warning(s)
>>>
>>>
>>>---------------------- Done ----------------------
>>>
>>>    Build: 0 succeeded, 1 failed, 0 skipped
>>>
>>>
>>>Any idea what I'm doing wrong?
>>>
>>>Cheers,
>>>
>>>Chris
>>>
>>>_______________________________________________
>>>Stk mailing list
>>>Stk@ccrma.stanford.edu
>>>http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>_______________________________________________
>>Stk mailing list
>>Stk@ccrma.stanford.edu
>>http://ccrma-mail.stanford.edu/mailman/listinfo/stk
> 
>