0

Windowsでlibxml2を単純なobjective-cにリンクしようとしていますが、libとヘッダーが配置されています。

私のGNUmakefileは次のようになります:

include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = sample_app
sample_app_CFLAGS = -Ic:/GNUstep/include/libxml2 -lxml2
sample_app_LDFLAGS =-Lc:/GNUstep/lib -lxml2
ADDITIONAL_FLAGS += -Ic:/GNUstep/include/libxml2 -lxml2
ADDITIONAL_LDFLAGS+=-Lc:/GNUstep/lib -lxml2

sample_app_HEADERS = HttpManager.h UT.h HtmlParser.h
sample_app_OBJC_FILES = main.m HttpManager.m UT.m HtmlParser.m
sample_app_RESOURCE_FILES =

include $(GNUSTEP_MAKEFILES)/tool.make

HtmlParser.m/h で HtmlParser を呼び出した私の実装ファイルは次のようになります。

#import <Foundation/Foundation.h>
#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/HTMLparser.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>

@interface HtmlParser :NSObject
{
    NSString* encoding;
}

 -(void)ExtractInnerSiteLinks:(NSString*) PageHtml:(NSString*) url;


@end


#import "HtmlParser.h"
#import "UT.h"
@implementation HtmlParser

-(id) init
{
    self = [super init];
    if(self) {
        encoding = @"UTF-8";
    }

    return self;

}


-(void) ExtractInnerSiteLinks:(NSString*) PageHtml:(NSString*) url
{

    NSData* documentData = [PageHtml dataUsingEncoding:NSUTF8StringEncoding];
    NSData* urlData = [url dataUsingEncoding:NSUTF8StringEncoding];
    const char *cEncoding =[encoding UTF8String];
    xmlDocPtr doc;
    /*

    htmlReadMemory  (const char *buffer,
                     int size,
                     const char *URL,
                     const char *encoding,
                     int options); 

    */
    doc = htmlReadMemory([documentData bytes],
                               [documentData length],
                               /*[urlData bytes]*/NULL,
                               /*cEncoding*/NULL,
                               HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NONET);

} 
 @end

私が実行したとき: CC=clang
im 取得を行います:

$ make CC=clang
This is gnustep-make 2.6.2. Type 'make print-gnustep-make-help' for help.
Making all for tool sample_app...
 Compiling file main.m ...
clang: warning: -lxml2: 'linker' input unused when '-c' is present
 Compiling file HttpManager.m ...
clang: warning: -lxml2: 'linker' input unused when '-c' is present
 Compiling file UT.m ...
clang: warning: -lxml2: 'linker' input unused when '-c' is present
 Compiling file HtmlParser.m ...
clang: warning: -lxml2: 'linker' input unused when '-c' is present
HtmlParser.m:25:10: warning: unused variable 'urlData' [-Wunused-variable]
        NSData* urlData = [url dataUsingEncoding:NSUTF8StringEncoding];
                ^
HtmlParser.m:26:14: warning: unused variable 'cEncoding' [-Wunused-variable]
        const char *cEncoding =[encoding UTF8String];
                    ^
2 warnings generated.
 Linking tool sample_appscrapper ...
./obj/sample_appscrapper.obj/HtmlParser.m.o: In function `-[HtmlParser ExtractInnerSiteLinks::]':
d:/dev/objc/sample_appscrapper/HtmlParser.m:37: undefined reference to `htmlReadMemory'
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
make[3]: *** [obj/sample_appscrapper.exe] Error 1
make[2]: *** [internal-tool-all_] Error 2
make[1]: *** [sample_appscrapper.all.tool.variables] Error 2
make: *** [internal-all] Error 2

メイク -n :

$ make -n CC=clang
This is gnustep-make 2.6.2. Type 'make print-gnustep-make-help' for help.
(make -f GNUmakefile --no-print-directory --no-keep-going \
        internal-master-tool-all \
        GNUSTEP_BUILD_DIR="." \
        _GNUSTEP_MAKE_PARALLEL=yes)
( \
instance=sample_app; \
operation=all; \
type=tool; \
abs_build_dir="."; \
if [ "" != "" ]; then \
  echo "Making $operation in subprojects of $type $instance..."; \
  for f in  __done; do \
    if [ $f != __done ]; then       \
      if [ "${abs_build_dir}" = "." ]; then \
        gsbuild="."; \
      else \
        gsbuild="${abs_build_dir}/$f"; \
      fi; \
      if [ "" = "" ]; then \
        if [ "$type" = "framework" ]; then \
          if [ "no" = "yes" ]; then \
            framework_version=""; \
            if [ "$framework_version" = "" ]; then \
              framework_version=""; \
              if [ "$framework_version" = "" ]; then \
                framework_version=""; \
                if [ "$framework_version" = "" ]; then \
                  framework_version="0"; \
                fi; \
              fi; \
            fi; \
            owning_project_header_dir="../${instance}.framework/Versions/${framework_version}/Headers"; \
          else \
            owning_project_header_dir="../${instance}.framework/Headers"; \
          fi; \
       else owning_project_header_dir=""; \
       fi; \
      else \
        owning_project_header_dir="../"; \
      fi; \
      if make -C $f -f GNUmakefile --no-print-directory --no-keep-going $operation \
          OWNING_PROJECT_HEADER_DIR_NAME="${owning_project_header_dir}" \
          DERIVED_SOURCES="../derived_src" \
          GNUSTEP_BUILD_DIR="$gsbuild" \
          _GNUSTEP_MAKE_PARALLEL=no \
        ; then \
        :; \
      else exit $?; \
      fi; \
    fi; \
  done; \
fi; \
echo "Making $operation for $type $instance..."; \
make -f GNUmakefile --no-print-directory --no-keep-going \
    internal-${type}-$operation \
    GNUSTEP_TYPE=$type \
    GNUSTEP_INSTANCE=$instance \
    GNUSTEP_OPERATION=$operation \
    GNUSTEP_BUILD_DIR="${abs_build_dir}" \
    _GNUSTEP_MAKE_PARALLEL=no)
Making all for tool sample_app...
(make -f GNUmakefile --no-print-directory --no-keep-going \
        internal-tool-compile \
        GNUSTEP_TYPE=tool \
        GNUSTEP_INSTANCE=sample_app \
        GNUSTEP_OPERATION=compile \
        GNUSTEP_BUILD_DIR="." \
        _GNUSTEP_MAKE_PARALLEL=yes)
(echo " Linking tool sample_app ...";clang  -Wl,--enable-auto-import -Lc:/GNUstep/lib -lxml2 -Lc:/GNUstep/lib -lxml2      -shared-libgcc -fexceptions -fgn
u-runtime -o obj/sample_app.exe \
                ./obj/sample_app.obj/main.m.o ./obj/sample_app.obj/HttpManager.m.o ./obj/sample_app.obj/UT.m.o ./obj/sample_app.obj/Html
Parser.m.o \
                     -L/home/meiry/GNUstep/Library/Libraries -L/GNUstep/Local/Library/Libraries -L/GNUstep/System/Library/Libraries     -lgnustep-base    -lobjc
   -lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 -lmpr -lnetapi32 -lm -I. )
4

0 に答える 0