C++ 11 und lib integrieren in exe



  • Hallo,

    Ich bin neu hier auf dem Bereich rund um C und C++.
    Und ich habe seit Wochen an einer Anwendung, die etwas älter ist gearbeitet.
    Leider komme ich dazu nicht weiter.

    g++ main.cc licensing/license-manager-key-register.cc -I/usr/local/lib -std=c++11 -O3 -o license-manager -LIB licensepp.lib
    
    
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text$_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE8validateEPKNS_7LicenseEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE8validateEPKNS_7LicenseEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xa0): undefined reference to `licensepp::IssuingAuthority::validate(licensepp::License const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x399): undefined reference to `licensepp::IssuingAuthority::issue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x3be): undefined reference to `licensepp::License::toString[abi:cxx11]()'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x455): undefined reference to `licensepp::License::formattedExpiry[abi:cxx11]() const'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x6f2): undefined reference to `licensepp::License::License()'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x702): undefined reference to `licensepp::License::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccjwynxO.o:main.cc:(.text.startup+0x84c): undefined reference to `licensepp::License::formattedExpiry[abi:cxx11]() const'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccyW2n2C.o:license-manager-key-register.cc:(.text.startup+0xfe): undefined reference to `licensepp::IssuingAuthority::IssuingAuthority(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool)'
    /users/downloads/cppp/pocketcpp/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../x86_64-w64-mingw32/bin/ld.exe: \Users\AppData\Local\Temp\ccyW2n2C.o:license-manager-key-register.cc:(.text.startup+0x13b): undefined reference to `licensepp::IssuingAuthority::IssuingAuthority(licensepp::IssuingAuthority const&)'
    collect2.exe: error: ld returned 1 exit status
    make: *** [Makefile:2: license-manager] Error 1
    

    Vielleicht kann mir jemand von Euch etwas behilflich sein, da ich eher aus Zeiten Pascal und Basic komme.

    Grüsse
    Chris


  • Mod

    Mach mal "-llicensepp.lib" statt "-LIB licensepp.lib". Eventuell musst du auch noch mit "-L" den Pfad angeben, unter dem licensepp.lib gefunden werden kann, je nachdem, wie genau das bei dir installiert ist



  • Hallo,

    gib mal, anstatt -LIB licensepp.lib, -llicensepp an (-l (kleines L) ist der Parameter zur Angabe einer externen Library - außerdem wird die Endung dabei nicht mitangegeben), s.a. Link Options (GCC).



  • Hallo zusammen und einen schönen Samstag Abend,

    sorry, dass ich da nur sehr speziell geschrieben hatte.
    Ich war komplett übermüdet und hatte das falsche Fenster kopiert mit der Fehlermeldung.
    Ich kann Euch etwas bessere Details zu Fehler berichten:

    Versuch hier mit msys64 lib Datei in usr und lib von mingw64
    makefile gibt einen Error aus und direkt g++ passiert nichts.

    Ich habe noch weitere versuche, diesen muss ich jedoch nochmals Reproduzieren.
    da ich den Bildschirm nicht kopierte.

    $ ./makefile
    ./makefile: line 1: license-manager:: command not found
    
    user@LAPTOP MINGW64 /c/Users/user/Downloads/licensepp-master/licensepp-master/DM-cli
    $ g++ main.cc licensing/license-manager-key-register.cc -I/usr/local/lib -L/usr/lib/ -llicensepp -std=c++11 -O3 -o license-manager
    
    user@LAPTOP MINGW64 /c/Users/user/Downloads/licensepp-master/licensepp-master/DM-cli
    $
    
    

    Herzliche Grüsse
    Chris



  • Dieser Versuch wurde nun mit Dev-C++ aus sf in der vorhandenen
    aktuellen Verson versucht, da ich vor Tagen eine entsprechend kuriose Error Meldung hatte.

    Da wäre der Error Bericht was aus makefile resultierte:

    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text+0x59b): undefined reference to `licensepp::License::License()'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text+0x5ae): undefined reference to `licensepp::License::loadFromFile(std::string const&)'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text+0x653): undefined reference to `licensepp::License::formattedExpiry() const'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text+0x7f4): undefined reference to `licensepp::License::toString()'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text+0x877): undefined reference to `licensepp::License::formattedExpiry() const'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text$_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE8validateEPKNS_7LicenseEbRKSs[_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE8validateEPKNS_7LicenseEbRKSs]+0x154): undefined reference to `licensepp::IssuingAuthority::validate(licensepp::License const*, std::string const&, bool, std::string const&) const'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.text$_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE5issueERKSsjPKNS_16IssuingAuthorityES4_S4_S4_[_ZNK9licensepp18BaseLicenseManagerI25LicenseManagerKeyRegisterE5issueERKSsjPKNS_16IssuingAuthorityES4_S4_S4_]+0x6b): undefined reference to `licensepp::IssuingAuthority::issue(std::string const&, unsigned int, std::string const&, std::string const&, std::string const&, std::string const&) const'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.rdata$.refptr._ZN25LicenseManagerKeyRegister29LICENSE_MANAGER_SIGNATURE_KEYE[.refptr._ZN25LicenseManagerKeyRegister29LICENSE_MANAGER_SIGNATURE_KEYE]+0x0): undefined reference to `LicenseManagerKeyRegister::LICENSE_MANAGER_SIGNATURE_KEY'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\main.o	main.cc:(.rdata$.refptr._ZN25LicenseManagerKeyRegister27LICENSE_ISSUING_AUTHORITIESE[.refptr._ZN25LicenseManagerKeyRegister27LICENSE_ISSUING_AUTHORITIESE]+0x0): undefined reference to `LicenseManagerKeyRegister::LICENSE_ISSUING_AUTHORITIES'
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\collect2.exe	[Error] ld returned 1 exit status
    Zeile 25: 
    C:\Users\TEST_USER_TÄTÖ\Downloads\licensepp-master\licensepp-master\DM-cli-Dev-C\Makefile.win	recipe for target 'DM-lic-man3.exe' failed
    
    

    Das wäre die makefile Datei aus Dev-C++:

    # Project: DM-lic-man
    # Makefile created by Dev-C++ 5.11
    
    CPP      = g++.exe
    CC       = gcc.exe
    WINDRES  = windres.exe
    OBJ      = main.o
    LINKOBJ  = main.o
    LIBS     = -L"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/lib" -L"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -L"C:/Users/TEST_USER_TÄTÖ/Downloads/licensepp-master/licensepp-master/DM-cli-Dev-C/lib" lib/cryptopp.lib lib/licensepp.lib lib/ripe.lib -pg
    INCS     = -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/licensepp-master/licensepp-master/DM-cli-Dev-C/licensing"
    CXXINCS  = -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/Dev-Cpp 5.11 TDM-GCC x64 4.9.2 Portable/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -I"C:/Users/TEST_USER_TÄTÖ/Downloads/licensepp-master/licensepp-master/DM-cli-Dev-C/licensing"
    BIN      = DM-lic-man3.exe
    CXXFLAGS = $(CXXINCS) -std=c++11 -pg
    CFLAGS   = $(INCS) -std=c++11 -pg
    RM       = rm.exe -f
    
    .PHONY: all all-before all-after clean clean-custom
    
    all: all-before $(BIN) all-after
    
    clean: clean-custom
    	${RM} $(OBJ) $(BIN)
    
    $(BIN): $(OBJ)
    	$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)
    
    main.o: main.cc
    	$(CPP) -c main.cc -o main.o $(CXXFLAGS)
    

    Zuvor habe ich versucht jegliche Fehler, welche durch nicht erkennen, der Source Dateien entstanden sind zu korrigieren.

    Grüsse
    Chris



  • Hast du selber die libs\... Einträge am Ende der Zeile LIBS = ... vorgenommen?
    Diese sollten, wie schon von uns geschrieben, mittels -l... angegeben werden (außer es wären selbst Object-Dateien .o bzw. .obj).

    Edit:
    Du hast m.E. den Teilpfad lib zu viel angegeben, da du das lib-Verzeichnis ja direkt bei -L".../lib" schon angegeben hast.
    Also sollte der hintere Teil so aussehen:

    -lcryptopp -llicensepp -lripe 
    

    Und die Angabe -pg (für Profiling Informationen) steht ja schon bei den CXXFLAGS und sollte daher bei LIBS nicht nochmal angegeben werden (hat ja auch nichts mit den Compilerflags zu tun).

    PS:
    Und besser wäre es, wenn die Dateipfade über Environment-Variablen oder mittels relativer Pfade angegeben werden (jetzt ist dieses makefile nur auf deinem Rechner ausführbar).


Anmelden zum Antworten