I'm new in C/front and I'm having trouble compiling the sample program (sample.c) that comes with the Navision CD. I have C/Front for Navision 4.00 and I try to compile with C++ (Visual Studio .NET).
I get many errors like the one that follows:
error C2664: 'stricmp' : cannot convert parameter 1 from 'DBL_U8 *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Any ideas?
Thanks
0
Comments
I use C#: no problem, only a lot of work.
Search for dllimport in this forum. Also look in the cf.h file for the exact interface.
www.dasautomatisering.nl
After coping the content of sample.c to sample.cpp and libload.c to libload.cpp and compilation of sample.cpp with Visual Studio .NET 2003 you get the following error:
C1083 Include_file can’t be loaded ‘cf/ch.h’
Solution: change
To
The same applies to lipload.cpp.
Next error C1004 says that the file ends unexpected just delete the last symbol in the cf.h
After a little search [1] [2] [3] I found that it is a convert problem.
The Code above shows that NDBCDriverName is a pointer to ‘unsigned char’ but ‘stricmp’ is requires a pointer to 'const char', the almost the same applies to lines below here ‘SessionInit’ is waiting for a pointer to unsigned char. The Solution is a typecast:
The next error C2440 ‘=’:’void*’ can’t be converted to ‘’comes after compiling libload.cpp
This means the function malloc gives out a void value witch need to be converted by typecast to HDLLSESSION, HDLLSESSION is a static struct DLL* as shown:
So the solution is as follows:
The last error C2664 says ‘strcpy’ converting of parameter 2 from ‘DBL_U8*’ to ‘const char*’ is not possible.
DLLName is a DBL_U8 type and as such it is unsigned char, so that means a pointer to unsigned char can’t be converted to a pointer to const char.
The Solution:
Finally copy all needed files as descript in readme.txt of c/front sample to the debug folder, compil the sample.exe and have fun. =D>