I have a small program that uses this function:
Function RichEdit_LoadRtfFromFile ( _
ByVal hRichEdit As Dword, _ ' // Handle of the Rich Edit control
ByVal strFileName As String _ ' // Name of the file to load
) As Long ' // TRUE or FALSE
I get "duplicate name definition" when using Jose's Inc's It compiles fine with the PBwin INCs.
Suggestions?
That function is defined in Jose's RichEditCtrl.inc file.
FUNCTION RichEdit_LoadRtfFromFile ( _
BYVAL hRichEdit AS DWORD _ ' // Handle of the Rich Edit control
, BYVAL strFileName AS STRING _ ' // Name of the file to load
) AS LONG ' // TRUE or FALSE
That function also calls RichEdit_LoadRtfFromFileCallback.
FUNCTION RichEdit_LoadRtfFromFileCallback ( _
BYVAL hFile AS DWORD _ ' // Value of the dwCookie member of the EDITSTREAM structure.
, BYVAL lpBuff AS BYTE PTR _ ' // Pointer to a buffer to write to.
, BYVAL cb AS LONG _ ' // Number of bytes to write.
, BYREF pcb AS LONG _ ' // Number of bytes actually written.
) AS DWORD ' // 0 for success, or an error code
I don't think that those functions are defined in the includes that ship with the api files in the PB9 compiler.
I posted that function, and another called RichEdit_LoadRtfFromResource, taken from my include files, in Paul's old forum, where you must have got it. The solution is very simple: remove the duplicate from your code.
whenever that happens i just move the load order of the includes in the compiler, works every time.
sometimes jose first, sometimes standard win32. just look at compiler options in the ide.
Added later:
This still happens, and I am using the very latest version of Jose's files. If I am compiling a FireFly project in the pb ide I just have to watch the order of the directories in the compiler options search list.
If you`re using Jose`s Header`s, you can`t encounter this Problem`s..
I use the header`s also without those issues - normally i would say: "Don`t mix different Includes or don`t use
different Version`s together"
The last newest Version of Jose`s Api-Header`s are compatible with the PBWin headerfile`s...
How is your statement you`re using dor the include??
#INCLUDE "GDIMAGE.INC" or
#INCLUDE ONCE "GDIMAGE.INC" or
#IF NOT %DEF(%GDIMAGE_INC)
#INCLUDE "GDIMAGE.inc"
#ENDIF
...
??
Also ich verstehe das nicht was willst du denn da sagen?
Hallo Theo,
offensichtlich liest der Compiler bei der Importroutine der include Dateien, Duplikate ein. Das geht natürlich nicht!
Es kann auch sein dass der Compiler versucht eine ganze include Datei doppelt zu lesen.
For Example:
#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"
#INCLUDE "MyUserA.inc"
#INCLUDE "MyUserB.inc"
in MyUserA.inc:
IF %DEF(%USEMACROS)
MACRO FUNCTION Userfunction
END MACRO
#ELSE
FUNCTION Userfunction
END FUNCTION
#ENDIF
In the file "MyUserB.inc" or in another include file exist the statement "#INCLUDE "MyUserA.inc"" a second time.
The Userfunction exist only one time in the include files, only in "MyUserA.inc" but the Compiler
is reading the Userfunction again and compile fail`s.
Error: duplicate name definition
The general Solution is to define a Constant for the include file.
The definition is placed at the top of the include.
For Example:
in MyUserA.inc:
#IF NOT %DEF(%MYUSERA_INC)
%MYUSERA_INC = 1
IF %DEF(%USEMACROS)
MACRO FUNCTION Userfunction
END MACRO
#ELSE
FUNCTION Userfunction
END FUNCTION
#ENDIF '// IF %DEF(%USEMACROS)
#ENDIF '// #IF NOT %DEF(%MYUSERA_INC) <-- #ENDIF at the end of file, best with a marker for allocation
Gruß,
Jürgen
I will tell it once more: My headers aren't extensions to the ones provided with the compiler, but a full replacement. Therefore, you MUST NOT mix the paths of both in the PB IDE. If you want to use my headers with the PB IDE, REMOVE ANY REFERENCE to the PB include files in the IDE's include path.
The only file that you may need to copy in my include's folder, if you're a PBFORMS user, is PBFORMS.INC.
Quote
Unzip the attached file to a folder of your choice and replace the PB Include path in the PB Ide or the editor that you are using to that folder instead of C:\PBWin90\WinApi.