Maths Library

Just starting out? Need help? Post your questions and find answers here.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

I must admit that I am not a C expert :?
The compiler keeps saying no include path in which to search for ... followed by files like stdio.h and math.h
What am I doing wrong?
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

what compiler are you using?
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

The MinGW/GCC compiler
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

1: did you install at the default location namely C:\MinGW ?
2: did you run the batch file MKALLMGW.BAT ?

right-click on My Computer/properties
click on Advanced then click Environment Variables
on the system variables pane click New
on the variable name put: LIBRARY_PATH
on the variable value put: C:\MinGW\lib

also on same pane edit the variable Path and add
;C:\MinGW\bin

after you finish log off then log back in
try compiling again
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

Now it works :D
Thanks a quintillion times jack - it does handle big numbers, right? :wink:
Your help is very appreciated :D

By the way the debugger says that the specified '*MemoryID' is not valid at line 133

Code: Select all

FreeMemory(al)
Do you know why?
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

I am glad you were able to make it work, when you try something new it's a bit disconcerting, in answer to your question, yes it handles big numbers,
though for some operations like divide you must specify to how many places you want the resulting operation.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Arctic Fox, the PB debugger does not work under this circumstances, at least it did not last I checked.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

jack wrote:Arctic Fox, the PB debugger does not work under this circumstances, at least it did not last I checked.
OK, thanks for the information. I am just curious to know what's wrong, as it crashes every time I run it. And when commenting out that line, it does not :?
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

if you turn off the debugger it works OK, I think ( only guessing ) the reason that PB crashes when debugger is on is because the memory was not allocated using native PB Commands.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

It still crashes here, regardless whether the debugger is on or off :(
And by the way m_apm_free_all_mem() raises a POLINK error when compiling (if used outside the ImportC).

Perhaps my library compilation doesn't work as it should :?
Would you mind comparing your lib file with mine (by file size)? My lib is 111.430 bytes.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Arctic Fox, you must include the import section, if your code is to use the mapm functions, it tell PB and Polink what functions to link into your program.
are you sure the debugger is off? is the spider/bug icon highlighted or not? if highlighted then debug is on.
btw the size of my lib is 110,592 bytes
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

The debugger is off, yes. No highlighted bug button in the toolbar, and no check mark in the menu or in Enable Debugger in Compiler Options.

btw are you using the libc.lib file? I've included it in M_APM.h as you adviced (the two lines were to be added at the end of the file, weren't they?)
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Arctic Fox, sorry I misled you, if you compile with Mingw32 there's no need to add anything M_APM.h.
if you are using Mingw32, all you need to do is run MKALLMGW.BAT and rename libmapm.a to libmapm.lib or mapm.lib and copy that to the PureBasic\PureLibraries\Windows\Libraries folder making sure you use the same name in the import section.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Post by Arctic Fox »

jack wrote:Arctic Fox, sorry I misled you, if you compile with Mingw32 there's no need to add anything M_APM.h.
That's okay mate, if it wasn't for you I hadn't got so far in this, thanks again :)
I recompiled the library without those two lines in M_APM.h, resulting in a library as big as yours. But your example still crashes at FreeMemory() with and without the debugger on :(
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I don't think you can use FreeMemory on anything that isn't a memory block you previously allocated with PureBasic. Do the library docs say that you need to free the memory?
BERESHEIT
Post Reply