Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 11:08:03 +0000



Compilier error

View Count: 1904

[2016-09-03 20:24:00]
ertrader - Posts: 645
Hi Support...I've followed the instructions for 1459. I also clicked the install compiler option and it just redoes the installation I have already done.

NOTICE: New Custom Studies DLL Compiler/Solution to Compile Error Issue

The following are errors I now get. The prior compiler to 1459 worked without any errors for my custom code. I will need to downgrade for now back to 1455

Can you please fix.
Best regards

-- Starting build of Custom Studies Source files: AutoTradeSignalV6DOE.cpp. -- 15:20:48

The Visual C++ compiler is not installed. Press the 'Install Compiler' button to download and install the compiler.
C:\WINDOWS\system32\cmd.exe /C "C:\SierraChart\ACS_Source\VisualCCompile.Bat"


C:\SierraChart\ACS_Source>call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
AutoTradeSignalV6DOE.cpp
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(388): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(416): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(821): warning C4244: 'initializing': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(831): warning C4244: 'initializing': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(832): warning C4244: 'initializing': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(1258): warning C4244: '=': conversion from 'float' to 'int', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(1384): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2615): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2617): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2626): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2627): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2628): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2629): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2630): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2631): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2632): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2745): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2759): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
Creating library AutoTradeSignalV6DOE.lib and object AutoTradeSignalV6DOE.exp
Generating code
c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2724) : error C4716: 'ProcessingFile': must return a value
c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2706) : error C4716: 'ControlFile': must return a value
c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2700) : error C4716: 'ReadTradeSignalParams': must return a value
c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2731) : error C4716: 'StartProcessing': must return a value
c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2715) : error C4716: 'WriteFile': must return a value
LINK : fatal error LNK1257: code generation failed
-- End of Build -- 15:21:00
Date Time Of Last Edit: 2016-09-03 20:28:30
[2016-09-03 20:33:49]
ertrader - Posts: 645
The last error at 2715 happens with the following code. The other errors at 2724, 2706, 2700 and 2731 use the same call process so once fixed, all can be fixed.


float WriteFile(SCStudyInterfaceRef sc)
{
  std::ofstream output;
  output.open ("writefile.txt", std::ofstream::out | std::ofstream::app);

  // insert into the file and add spaces between variables
  output << g_ControlLine << " " << g_ProfitFactor << " " << g_TotalPercentProfitable << " " << g_MaximumDrawdown << " " << g_MaximumTradeRunup <<" " << g_TotalTrades << " " << g_TotalLongTrades << " " << g_TotalShortTrades << "\n";
  output.close();
}
Date Time Of Last Edit: 2016-09-03 20:44:28
[2016-09-03 20:34:47]
ertrader - Posts: 645
At the top of my code, I set up the call:
float WriteFile(SCStudyInterfaceRef sc);
[2016-09-03 20:37:07]
ertrader - Posts: 645
Here are all the functions that are failing now:
int ControlFile(SCStudyInterfaceRef sc)
{
  std::ifstream input("controlfile.txt");
  // set the global variables to local variables so the parameters are passed  
  input >> g_ControlLine;
}
float WriteFile(SCStudyInterfaceRef sc)
{
  std::ofstream output;
  output.open ("writefile.txt", std::ofstream::out | std::ofstream::app);

  // insert into the file and add spaces between variables
  output << g_ControlLine << " " << g_ProfitFactor << " " << g_TotalPercentProfitable << " " << g_MaximumDrawdown << " " << g_MaximumTradeRunup <<" " << g_TotalTrades << " " << g_TotalLongTrades << " " << g_TotalShortTrades << "\n";
  output.close();
}
int ProcessingFile(SCStudyInterfaceRef sc)
{
  std::ofstream output;
  output.open ("processing.txt", std::ofstream::out | std::ofstream::ate);

  // insert into the file and add spaces between variables
  output << g_Processing;
  output.close();
}

int StartProcessing(SCStudyInterfaceRef sc)
{
  // enable or disable processing. 0 = disable, 1 = enable. Used to control when initially loading the study
  std::ifstream input("startprocessing.txt");
  input >> g_StartProcessing;
}
[2016-09-03 20:37:44]
ertrader - Posts: 645
At the top of my code:


float ReadTradeSignalParams(SCStudyInterfaceRef sc);
int ControlFile(SCStudyInterfaceRef sc);
float WriteFile(SCStudyInterfaceRef sc);
int ProcessingFile(SCStudyInterfaceRef sc);
int StartProcessing(SCStudyInterfaceRef sc);
[2016-09-03 20:56:31]
Sierra Chart Engineering - Posts: 104368
There is nothing for us to fix! The Microsoft Visual C++ is a very good optimizing compiler and only gives you warnings and errors which are correct and you need to solve.

You need to correct the errors and warnings in your own code.

A function that has a return type other than void must return a value. It is that simple.

Warnings like this can be solved with a typecast:

C:\SierraChart\ACS_Source\AutoTradeSignalV6DOE.cpp(2759): warning C4244: '=': conversion from 'int' to 'float', possible loss of data

Refer to:
http://www.cplusplus.com/doc/tutorial/typecasting/
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2016-09-03 20:57:00
[2016-09-03 21:02:50]
ertrader - Posts: 645
The examples I listed with code are not warnings but errors:

c:\sierrachart\acs_source\autotradesignalv6doe.cpp(2724) : error C4716: 'ProcessingFile': must return a value

Yes, I am willing to fix...I do not know how to fix however.
[2016-09-03 21:07:34]
Sierra Chart Engineering - Posts: 104368
This is what we said:


A function that has a return type other than void must return a value. It is that simple.

You could add a return 0; at the end. Or just simply change the return type to a void.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2016-09-03 21:08:05
[2016-09-04 15:33:04]
ertrader - Posts: 645
Got it..appreciate the quick response and suggestion....this compiler did catch other issues and my code is all cleaned up and working.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account