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

Bug reports and errors in the program
Message
Author
Wessel
Posts: 59
Joined: Tue Oct 12, 2010 6:45 pm

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

#1 Postby Wessel » Tue May 24, 2011 6:15 am

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
Attachments
Bug C++ API ScriptInterdaceUnit.rar
MSVC++ Project demonstrating the bug
(12.08 KiB) Downloaded 271 times

Wessel
Posts: 59
Joined: Tue Oct 12, 2010 6:45 pm

#2 Postby Wessel » Tue May 24, 2011 6:52 am

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
Attachments
ScriptInterfaceUnit.rar
v1.2a of ScriptInterfaceUnit.h Fixed some bugs and added more C++ calls. See inside file for more information
(9.16 KiB) Downloaded 276 times

mspen
Posts: 8
Joined: Wed Sep 10, 2008 3:57 pm
Location: San Diego

#3 Postby mspen » Thu Aug 25, 2011 12:28 pm

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)


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 1 guest