error LNK2001: Nichtaufgeloestes externes Symbol _fnmerge



  • Hallo!

    Ich habe folgendes Problem mit einer Fehlermeldung.

    Mein Source code sieht etwa so aus.

    #include <windows.h>
    #include <stdio.h>
    #include <dir.h>
    #include <dos.h>
    #include <math.h>
    #include <string.h>

    ...
    ...
    ...

    static char szDrive[MAXDRIVE], szDir[MAXDIR], szName[MAXFILE], szExt[MAXEXT] ;

    ...
    ...
    ...

    fnsplit(ofn.lpstrFile, szDrive, szDir, szName, szExt) ;

    ...
    ...
    ...

    fnmerge (ofn.lpstrFile, szDrive, szDir, szName, szExt) ;
    fnmerge (ofn.lpstrFileTitle, NULL, NULL, szName, szExt) ;

    Was folgenden Fehler erzeugt:

    ace.obj : error LNK2001: Nichtaufgeloestes externes Symbol _fnmerge
    ace.obj : error LNK2001: Nichtaufgeloestes externes Symbol _fnsplit
    Debug/aceorg2.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise
    Fehler beim Ausführen von link.exe.

    Ich muß dazu sagen, das der Source Code in BCB5 erstellt wurde und ich jetzt versuche das Programm unter MS Visual c++ 6 zum laufen zu bringen.

    Wo liegt der Fehler?



  • ich vermute, der borland benutzte das fnsplit aus der dir.h

    wie du siehst, ist es nicht portable, kein standard.

    für das studio musst du dann gleichwertiges suchen...richtung msdn und winapi schaun.

    #include <dir.h>
    
    int fnsplit (const char *path, char *drive, char *dir, 
    		char *name, char *ext);
    
    Description 
    This function decomposes a path into its components. It is smart enough to 
    know that . and .. are directories, and that file names with a leading dot, like `.emacs', are not all extensions. 
    
    The drive, dir, name and ext arguments should all be passed, but some or even 
    all of them might be NULL pointers. Those of them which are non-NULL should 
    point to buffers which have enough room for the strings they would hold. The constants MAXDRIVE, MAXDIR, MAXFILE and MAXEXT, defined on dir.h, define the maximum length of these buffers. 
    
    See section fnmerge. 
    
    Return Value 
    A flag that indicates which components were found: 
    
    DRIVE 
    The drive letter was found. 
    
    DIRECTORY 
    A directory or subdirectories was found. 
    
    FILENAME 
    A filename was found. 
    
    EXTENSION 
    An extension was found. 
    
    WILDCARDS 
    The path included * or ?. 
    
    Portability 
    ANSI/ISO C No  
    POSIX No
    


  • Hast du in etwa eine Idee was da gleichwertig sein könnte?

    Ich habe da bist jetzt noch nichts gefunden?



  • hier ein beispiel, wie sie funktioniert:

    char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
    int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
    d = "d:"
    p = "/djgpp/bin/"
    f = "gcc"
    e = ".exe"
    

    im notfall selber bauen



  • schau dich mal in der #include "Shlwapi.h" um, ich denke, damit kommst du am weitesten.

    #pragma comment(lib, "shlwapi.lib") nicht vergessen

    hier der msdn link:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/path/pathfindfilename.asp


Anmelden zum Antworten