Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Using Fluid Studios VMATH lib..

Started by ogracian Jan 19, 2005 at 5:43 PM 6 replies 2.7k views
Original Post
ogracian
ogracian
Hello I appreciate if someone could help me to get the Fluid Studios VMath.h library, I have tried a really simply test but it fail. Here is my code:

#include "VMath.h"
int main(void)
{
  Vector3 V1(0.0f, 0.0f, 0.0f);
  return 0;
}
 
But I got the following errors: Compiling... main.cpp c:\GameProjects\Test\VMath.h(113) : error C3861: 'TemplateAssert': identifier not found, even with argument-dependent lookup c:\GameProjects\SingletonTests\VMath.h(109) : while compiling class-template member function 'Matrix::Matrix(const T &,const T &,const T &)' with [ N=3, M=1, T=float ] c:\GameProjects\SingletonTests\main.cpp(36) : see reference to class template instantiation 'Matrix' being compiled with [ N=3, M=1 ] Thanks in advance, Oscar
Emmanuel Deloget
Emmanuel Deloget
It seems that the vmath lib lacks the definition of TemplateAssert(). You can find it in the "project/include/fstl/common" file in the FSRad-004 source code from fluid studios.

Here is the definition:
template <bool B> struct templateAssert {};struct templateAssert<true> {static void there_has_been_a_compile_time_assertion() {};};#define	TemplateAssert(__a) {const bool __b = (__a) ? true:false; templateAssert<__b>::there_has_been_a_compile_time_assertion();}#define	TemplateError(__msg) {const bool __b = (__a) ? true:false; templateAssert<__b>::##__msg();}

Very good tool, since it will issue a compiler error when the template argument is not correct. For example:

template <int N> class Foo{  public:  Foo()  {    TemplateAssert(N < 3);   }};


Will generate an error when you'll do:
  Foo<10> foo;


If there is no error, it will be dropped by the compiler - which will see that the evaluation of templateAssert::there_has_been_a_compile_time_assertion() does nothing.

HTH,
ogracian
ogracian
Hi,

Thank you very much, it was exactly the trouble. But now it present another error caused by the TemplateAssert, it halts in line "struct templateAssert {static void there_has_been_a_compile_time_assertion() {};};"

with the following error code:
c:\GameProjects\SingletonTests\VMath\common(61) : error C2906: 'templateAssert' : explicit specialization requires 'template <>'

PS: By the way I am using VisualStudio C++ .NET 2003 Pro.

Thanks in advance,
Oscar

[Edited by - ogracian on January 20, 2005 2:44:17 PM]
Emmanuel Deloget
Emmanuel Deloget
Yes. Of course. VS template handling change every two days :/

You have to add the bold string in order to make this thing work with VC7.

template <bool B> struct templateAssert {};template <> struct templateAssert<true> {static void there_has_been_a_compile_time_assertion() {};};#define	TemplateAssert(__a) {const bool __b = (__a) ? true:false; templateAssert<__b>::there_has_been_a_compile_time_assertion();}#define	TemplateError(__msg) {const bool __b = (__a) ? true:false; templateAssert<__b>::##__msg();}


HTH,
ogracian
ogracian
Hi, thank you very much Emmanuel for your help, finally got it working!.

Best Regards,
Oscar
Mercury
Mercury
Speaking of Paul Nettle, anyone know what happened to him and his projects? I haven't seen him update the website for Open Architect 3D in quite some time. It seemed like an interesting project and he's just ignoring it.
Emmanuel Deloget
Emmanuel Deloget
I don't know if these informations are accurate but it seems that he is still an instructor at gameinstitute.com. See his profile here. It seems I'm not able to find any other information about him. You may be able to mail to nFusion or GameInstitute (or fluidstudio) to see wether he is still alive or not.

Regards,

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.