Page 1 of 1

v1.2 ScriptInterfaceUnit.h(1589): error C2198: too few args

Posted: Tue May 24, 2011 6:15 am
by Wessel
When Compiling a ForexTester 2.7 Script with Microsoft Visual C++ Express (version 10.0.030319.1 ) the include ScriptInterfaceUnit.h (version 1.2) returns an error on line 1589 that the call has to view arguments and it fails to build.

The Script I am compiling is an empty Script template

Code: Select all

#include <windows.h>
#include "ScriptInterfaceUnit.h"
#include "TechnicalFunctions.h"


// External variables

//-------------------------------------------
// Initialization procedure
//-------------------------------------------
EXPORT void __stdcall Init(){
  ScriptShortName("Bug Cant compile me");
  ScriptDescription("Bug Cant compile me");

}

//---------------------------------------------------------------------------
// Execute script
//---------------------------------------------------------------------------
EXPORT void __stdcall Execute()
{
   Print("Hello World");
}

//-------------------------------------------
// Deinitialization procedure
//-------------------------------------------
EXPORT void __stdcall Done()
{
}


Bellow are the errors produced by the v1.2 of the ScriptInterfaceUnit.h:

Code: Select all

1>------ Rebuild All started: Project: AutoMM TradeNow, Configuration: Debug Win32 ------
1>  AutoMM TradeNow.cpp
1>c:\users\wessel\dropbox\development\forex tester 2\scripts\c++\bug\scriptinterfaceunit.h(968): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
1>c:\users\wessel\dropbox\development\forex tester 2\scripts\c++\bug\scriptinterfaceunit.h(1589): error C2198: 'TGetIntegerFunc' : too few arguments for call
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


The previous interface 1.0 compiled clean, a workaround is by removing lines 1586 till 1591, but we lose the Timeframe functionality :(

Please Fix! Attached is a minimal script example and full Visual C++ project that demonstrates the failure


Wessel

Posted: Tue May 24, 2011 6:52 am
by Wessel
Fixed it.
Attached is the fixed version + several enhancements that makes coding scripts in FT more C++ like than C like ;-)

Code: Select all

//-----Get current timeframe--------------------------------------------------
// BUGFIX Wessel, solution taken from IndicatorInterfaceUnit v1.12
/*int Timeframe()
{
  if (rec.Timeframe == NULL) return -1;
  return rec.Timeframe();
}
*/
int Timeframe()
{
  if (rec.pTimeframe == NULL) return -1;
  return int(rec.Timeframe(rec.pTimeframe));
}


Cheers,
Wessel

Posted: Thu Aug 25, 2011 12:28 pm
by mspen
Thanks for the fix. It now compiles clean. Just wondering if posting an example of the .def file would be useful. I made it up by reviewing the items in the ScriptInterface.h that were exported. The .def file that I am using is:

--------------------------- start
LIBRARY samplescript

EXPORTS Init
Execute
Done
ReplaceStr
IntrfProcsRec
--------------------------- finish


An empty script sample loaded and ran compiled with this.

I am using the following to compile:
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)