daniele wrote:
> hi, I'm trying to build a sample xpcom component written in c++ on a
> mac.
> the sample i'm trying is taken from
> http://www.iosart.com/firefox/xpcom/ this website.
>
> in order to have a working gecko sdk on my machine i downloaded the
> mozilla source and compile the xpcom module as follows:
>
> ./configure --enable-application=standalone
> --enable-standalone-modules=xpcom
> make
>
> and when i try to build the sample code the compiler complains always
> about some undefined symbols!
> i tried to adjust the provided makefile, and the last version i have is
> the following:
>
> CXX   = c++
> CPPFLAGS += -fno-rtti -fno-exceptions
>
> # Change this to point at your Gecko SDK directory.
> GECKO_SDK_PATH = ../../mozilla/dist
>
> XPIDL = $(GECKO_SDK_PATH)/bin/xpidl
> XPIDL_INCLUDE = $(GECKO_SDK_PATH)/idl
>
> GECKO_DEFINES = -DXPCOM_GLUE
>
> GECKO_INCLUDES = -I$(GECKO_SDK_PATH)/include
> -I$(GECKO_SDK_PATH)/include/xpcom -I$(GECKO_SDK_PATH)/include/nspr
>
> GECKO_LDFLAGS = -L$(GECKO_SDK_PATH)/lib -lxpcomglue -lnspr4 -lplds4
>
> FILES = MyComponent.cpp MyComponentModule.cpp
>
> TARGET = MyComponent.so
>
> build:
>       $(CXX) -bind_at_load -o $(TARGET) $(GECKO_CONFIG_INCLUDE)
> $(GECKO_DEFINES) $(GECKO_INCLUDES) $(CPPFLAGS) $(CXXFLAGS) $(FILES)
> $(GECKO_SDK_PATH)/lib/libxpcomglue_s.a $(GECKO_LDFLAGS)
>       chmod +x $(TARGET)
>       strip $(TARGET)
>
> but the compiler complains about the following undefined symbols:
>
> /usr/bin/ld: Undefined symbols:
> _main
> _CFBundleCopyExecutableURL
> _CFBundleGetMainBundle
> _CFRelease
> _CFStringGetCString
> _CFURLCopyFileSystemPath
> _CFURLCreateCopyDeletingLastPathComponent
> _kCFAllocatorDefault
> _CFBundleCopyPrivateFrameworksURL
> _CFURLCopyAbsoluteURL
> _CFURLCreateCopyAppendingPathComponent
> _CFURLGetFileSystemRepresentation
> ___CFConstantStringClassReference
> collect2: ld returned 1 exit status
>
> ideas?
>
> thanks

You need to link Apple's stuff, so you get all system symbols.

In your case, I think CoreFoundation.framework is sufficient, or
Cocoa.framework if you want Core Foundation + lots of GUI stuff.

You link in a framework with the -framework <framework name> linker
flag.

/Håkan

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to