Hi all,
I'm trying to build dlls to pull into FX tester 4. I'm trying to make them in C++ and have built the strategy in Visual Studio 2019, but I keep getting the following error:
Severity Code Description Project File Line Suppression State
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source? Dll1 C:\ForexTester2\Examples\Strategies\C++\ObjectsTest.cpp 144
I also get a number of other parameter related errors. I have added TechnicalFunctions.h, StrategyInterfaceUnit.h and also tried it with and without pch.h, but nothing seems to work, could anyone please advise? This is the screenshot:
Visual Studio 2019 C++ DLL strategy error
-
- Posts: 1479
- Joined: Mon Apr 01, 2013 3:55 am
Re: Visual Studio 2019 C++ DLL strategy error
Disable pch in project settings:
1. Project Menu -> Properties -> Configuration Properties -> C/C++ -> Precompiled Headers -> Precompiled Header set to "Not Using Precompiled Headers"
In StrategyInterfaceUnit.h change lines:
2. to
3. to
4. to
5. to
6. to
7. to
In StrategyInterfaceUnit.h:
8. insert after the line
9. insert before the line
In ObjectsTest.cpp change lines:
10. to
11. to
In ObjectsTest.cpp remove all occurances of
1. Project Menu -> Properties -> Configuration Properties -> C/C++ -> Precompiled Headers -> Precompiled Header set to "Not Using Precompiled Headers"
In StrategyInterfaceUnit.h change lines:
2.
Code: Select all
#define PChar char*
Code: Select all
#define PChar const char*
3.
Code: Select all
EXPORT void __stdcall ReplaceStr(PChar& dest, PChar source)
Code: Select all
EXPORT void __stdcall ReplaceStr(char*& dest, PChar source)
4.
Code: Select all
dest = (PChar)malloc(strlen((char*)source) + 1);
Code: Select all
dest = (char*)malloc(strlen((char*)source) + 1);
5.
Code: Select all
PChar IndicatorNameEx = (PChar)malloc(strlen(IndicatorName) + 4 + 1);
Code: Select all
char* IndicatorNameEx = (char*)malloc(strlen(IndicatorName) + 4 + 1);
6.
Code: Select all
#define EXPORT __declspec(dllexport)
Code: Select all
#define EXPORT extern "C" __declspec(dllexport)
7.
Code: Select all
EXPORT TInterfaceProcRec IntrfProcsRec;
Code: Select all
extern "C" { __declspec(dllexport) TInterfaceProcRec IntrfProcsRec; }
In StrategyInterfaceUnit.h:
8. insert
Code: Select all
#pragma warning (disable : 4996)
Code: Select all
#include <stdio.h>
9. insert
Code: Select all
#pragma comment(linker, "/EXPORT:ReplaceStr=_ReplaceStr@8")
Code: Select all
EXPORT void __stdcall ReplaceStr(char*& dest, PChar source)
In ObjectsTest.cpp change lines:
10.
Code: Select all
PChar Currency = NULL;
Code: Select all
char* Currency = NULL;
11.
Code: Select all
char* names[] = {"Line0", "Line1", "Line2", "Line3", "Fibo1",
Code: Select all
const char* names[] = {"Line0", "Line1", "Line2", "Line3", "Fibo1",
In ObjectsTest.cpp remove all occurances of
Code: Select all
__stdcall
-
- Posts: 1479
- Joined: Mon Apr 01, 2013 3:55 am
Re: Visual Studio 2019 C++ DLL strategy error
I've attached a files with correct changes
- Attachments
-
- ObjectsTest.zip
- (11.06 KiB) Downloaded 230 times
-
- Posts: 14
- Joined: Mon Apr 15, 2013 2:45 pm
Re: Visual Studio 2019 C++ DLL strategy error
Thanks so much! I'll try this out.
-
- Posts: 14
- Joined: Mon Apr 15, 2013 2:45 pm
Re: Visual Studio 2019 C++ DLL strategy error
Hi,
I tried this and made some adjustments, e.g. providing the full path to the header files seemed to do the trick, but I am now getting a 'E0311 cannot overload functions distinguished by return type alone' error, which I think implies the compiler cannot distinguish between two methods that are trying to do the same thing. I can't seem to attach the files even if they are zipped, I'd be grateful if anyone could help with regards to what else needs to be corrected and could try to arrange to send the files somehow.
Thanks again.
I tried this and made some adjustments, e.g. providing the full path to the header files seemed to do the trick, but I am now getting a 'E0311 cannot overload functions distinguished by return type alone' error, which I think implies the compiler cannot distinguish between two methods that are trying to do the same thing. I can't seem to attach the files even if they are zipped, I'd be grateful if anyone could help with regards to what else needs to be corrected and could try to arrange to send the files somehow.
Thanks again.
Return to “Programming lessons”
Who is online
Users browsing this forum: No registered users and 17 guests