It is possible to turn of Windows API constants?
It is possible to turn of Windows API constants?
I am using Mac OS to write my code. And now I am trying to compile it with Windows. The problem is: I use some names that are reserved for Windows constants and structures. Can I turn of including windows API and constants?
Re: It is possible to turn of Windows API constants?
you can move the windows.res out of the resident folder and it should do the trick
Re: It is possible to turn of Windows API constants?
It's better in the long run just to rename your constants,
instead of messing around with the PureBasic installation.
instead of messing around with the PureBasic installation.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: It is possible to turn of Windows API constants?
Code: Select all
CompilerIf Not Defined(WM_CLOSE, #PB_Constant)
#WM_CLOSE = 16
CompilerEndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Re: It is possible to turn of Windows API constants?
That won't fix his problem...
He's talking about that he defined his own constants and structures that conflict with WinAPI names.
------
Maybe you can just prefix your identifiers? I agree with PB, messing with plain
PB installations is not a good solution and it makes the code much less portable.
He's talking about that he defined his own constants and structures that conflict with WinAPI names.
------
Maybe you can just prefix your identifiers? I agree with PB, messing with plain
PB installations is not a good solution and it makes the code much less portable.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: It is possible to turn of Windows API constants?
So your target is now Windows and not OSX. Change your code accordingly to the new platform or better yet to both, and/or use conditional compilation if required.Lebostein wrote:I am using Mac OS to write my code. And now I am trying to compile it with Windows.
Trying to force your way in eradicating what's already natively defined in PB for a specific platform does look a very bad idea to me and it will come back to bite you sooner or later. This if you plan to reuse the code, to share it with someone else, etc.
If you just want to get an EXE right now I suppose Fred 's solution is just what you want.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: It is possible to turn of Windows API constants?
It would be easier to re-name your constants etc. uniquely ~ #Lebostein_WM_CLOSE will not be found on any OS.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: It is possible to turn of Windows API constants?
You should probably try to adapt your code around it. You may find the need to use some Win32 voodoo to get everything to run smoothly and then you'll be in trouble!
Re: It is possible to turn of Windows API constants?
Can I add all win constants and structs to the mac version? With this way the mac compiler should warn me if I use reserved things.