i'm using gpc (on the commandline, not in mw) in os x. i need to call a carbon library function.
the following line doesn't work:
{$L /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon}
when i try to compile with:
gpc testcarb.pas -o testcarb
... i get:
testcarb.pas:6: error: file `/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon' must be compiled
not sure what that means or what i can do about it.
thanks.
- philip
P. George wrote:
i'm using gpc (on the commandline, not in mw) in os x. i need to call a carbon library function.
the following line doesn't work:
{$L /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon}
when i try to compile with:
gpc testcarb.pas -o testcarb
... i get:
testcarb.pas:6: error: file `/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon' must be compiled
not sure what that means or what i can do about it.
Not sure about the circumstances, but generally: Don't put paths in the source. I.e., use `{$L Carbon}' if that's the name of the library (i.e., `libCarbon.a' or so, depending on your system's naming convention which I don't know), and use options such as `-L /System/Library/Frameworks/Carbon.framework/Versions/A'.
Besides (hopefully) avoiding this problem, it will help others compile this file who may have set up their directories differently.
Frank
P. George wrote::
i'm using gpc (on the commandline, not in mw) in os x. i need to call a carbon library function.
the following line doesn't work:
{$L /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon}
when i try to compile with:
gpc testcarb.pas -o testcarb
... i get:
testcarb.pas:6: error: file `/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon' must be compiled
not sure what that means or what i can do about it.
Download the Mac OS X Pascal interfaces http://www.microbizz.nl/GPCInterfacesC2.tar.gz and include GPCMacOSAll.pas (or separate smaller units) with the USES clause. Now, link to the Carbon framework with:
gpc -s -o testcarb testcarb.pas --automake -Wl,-framework,Carbon --unit-path=/Developer/Pascal/GPCPInterfaces -I/Developer/Pascal/GPCPInterfaces
See the example makefile in the "tools" folder included with the GPCPInterfaces.
Frank Heckenbach wrote:
Not sure about the circumstances, but generally: Don't put paths in the source. I.e., use `{$L Carbon}' if that's the name of the library (i.e., `libCarbon.a' or so, depending on your system's naming convention which I don't know), and use options such as `-L /System/Library/Frameworks/Carbon.framework/Versions/A'.
Interestingly, $L doesn't recognize /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon, although it is a Mach-O file and a dynamic library. So, this must be the reason why you get the "must be compiled" message ($L also accepts source files). I don't know (haven't checked) the naming conventions of the $L directive. Does it look at the file name suffix or does it check the binary (Mach-O) file type ?
Besides (hopefully) avoiding this problem, it will help others compile this file who may have set up their directories differently.
On Mac OS X, using the "frameworks" convention avoids the directory setup problem (as the dynamic libraries included with "frameworks" are in a fixed and known places for each version of the OS on all installations).
Regards,
Adriaan van Os
Download the Mac OS X Pascal interfaces http://www.microbizz.nl/GPCInterfacesC2.tar.gz and include GPCMacOSAll.pas (or separate smaller units) with the USES clause. Now, link to the Carbon framework with:
gpc -s -o testcarb testcarb.pas --automake -Wl,-framework,Carbon --unit-path=/Developer/Pascal/GPCPInterfaces -I/Developer/Pascal/GPCPInterfaces
See the example makefile in the "tools" folder included with the GPCPInterfaces.
i downloaded and installed the pascal interfaces using the link provided.
now when i do this:
gpc -s -o testcarb testcarb.pas --automake -Wl,-framework,Carbon --unit-path=/Developer/Pascal/GPCPInterfaces -I/Developer/Pascal/GPCPInterfaces
i get:
/usr/bin/ld: can't locate file for: -lCarbon collect2: ld returned 1 exit status
that seems like a small step toward success. what to do now?
thanks.
- philip
P. George wrote:
i downloaded and installed the pascal interfaces using the link provided.
now when i do this:
gpc -s -o testcarb testcarb.pas --automake -Wl,-framework,Carbon --unit-path=/Developer/Pascal/GPCPInterfaces -I/Developer/Pascal/GPCPInterfaces
i get:
/usr/bin/ld: can't locate file for: -lCarbon collect2: ld returned 1 exit status
Did you remove the $L directive ?
Regards,
Adriaan van Os
wohoo!!! it works!!!
thanks a million... seriously.
:-) :-) :-)
- philip
On Oct 5, 2004, at 3:09 AM, Adriaan van Os wrote:
P. George wrote:
i downloaded and installed the pascal interfaces using the link provided.
now when i do this:
gpc -s -o testcarb testcarb.pas --automake -Wl,-framework,Carbon --unit-path=/Developer/Pascal/GPCPInterfaces -I/Developer/Pascal/GPCPInterfaces
i get:
/usr/bin/ld: can't locate file for: -lCarbon collect2: ld returned 1 exit status
Did you remove the $L directive ?
Regards,
Adriaan van Os
Adriaan van Os wrote:
Frank Heckenbach wrote:
Not sure about the circumstances, but generally: Don't put paths in the source. I.e., use `{$L Carbon}' if that's the name of the library (i.e., `libCarbon.a' or so, depending on your system's naming convention which I don't know), and use options such as `-L /System/Library/Frameworks/Carbon.framework/Versions/A'.
Interestingly, $L doesn't recognize /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon, although it is a Mach-O file and a dynamic library.
As I wrote, paths in directives may or may not work, and are not recommended. (I'm wondering if I shouldn't prohibit them at all.)
Besides (hopefully) avoiding this problem, it will help others compile this file who may have set up their directories differently.
On Mac OS X, using the "frameworks" convention avoids the directory setup problem (as the dynamic libraries included with "frameworks" are in a fixed and known places for each version of the OS on all installations).
There's a difference between conventions and requirements. Most systems have directory conventions, but putting paths in the source files (where they can't be changed without changing the sources) turns them into requirements. There may be reasons to use different directories sometimes (e.g., installing things privately, or testing a different version). Using `-L' paths etc. avoids unnecessary problems then.
Frank