Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import third-party libraries #3

Closed
lonecrane opened this issue Jun 24, 2021 · 2 comments
Closed

How to import third-party libraries #3

lonecrane opened this issue Jun 24, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@lonecrane
Copy link

lonecrane commented Jun 24, 2021

Dear author,
I am newbie to C++ and know this is a question rather than a problem, but I really want to figure it out.

My plaform is on windows 10, and Visual Studio 2019 comunity is used.
What am I doing:

  1. Download the source codes of the four necessary third-party libraries.
  2. Compile these libraries, and get some .lib files such as distorm.lib, libssl_static.lib, libcrypto_static.lib.
  3. Copy these .lib files to a specific directory, e.g., Third-parties\Lib.
  4. Configure the property of the ntfstool project with VS2019. Add the above directory to the 'Additional library Directories' list, and add these obtained .lib files to the 'Aditional Dependencies' list.
  5. Copy all the include files of the the four libraries to a specific directory, e.g., Third-parties\Include.
  6. Make the ntfstool project 'Include' the directory 'Third-parties\Include' with VS2019.
  7. Compile the solution 'NTFS'.

However, I get some errors, such as

Error	LNK2001	unresolved external symbol distorm_decode64	ntfstool	E:\Code\cpp\ntfstool-master\utils.obj	1	
Error	LNK2019	unresolved external symbol distorm_decode64 referenced in function "void __cdecl print_jump(unsigned char * const)" (?print_jump@@YAXQEAE@Z)	ntfstool	E:\Code\cpp\ntfstool-master\command_vbr.obj	1	
Error	LNK2001	unresolved external symbol __imp_feof	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(ui_openssl.obj)	1	
Error	LNK2019	unresolved external symbol __imp_feof referenced in function file_ctrl	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(bss_file.obj)	1	
Error	LNK2001	unresolved external symbol __imp_ferror	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(ui_openssl.obj)	1	
Error	LNK2019	unresolved external symbol __imp_ferror referenced in function file_read	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(bss_file.obj)	1	
Error	LNK2001	unresolved external symbol __imp_fgets	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(ui_openssl.obj)	1	
Error	LNK2019	unresolved external symbol __imp_fgets referenced in function file_gets	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(bss_file.obj)	1	
Error	LNK2019	unresolved external symbol __imp_strerror_s referenced in function openssl_strerror_r	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(o_str.obj)	1	
Error	LNK2001	unresolved external symbol __imp_strncpy	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(evp_key.obj)	1	
Error	LNK2001	unresolved external symbol __imp_strncpy	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(x509_obj.obj)	1	
Error	LNK2019	unresolved external symbol __imp_strncpy referenced in function win32_joiner	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(dso_win32.obj)	1	
Error	LNK2001	unresolved external symbol __imp_strspn	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(v3_asid.obj)	1	
Error	LNK2001	unresolved external symbol __imp_strspn	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(v3_addr.obj)	1	
Error	LNK2019	unresolved external symbol __imp_strspn referenced in function PEM_get_EVP_CIPHER_INFO	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(pem_lib.obj)	1	
Error	LNK2019	unresolved external symbol __imp__gmtime64_s referenced in function OPENSSL_gmtime	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(o_time.obj)	1	
Error	LNK2001	unresolved external symbol __imp__stat64i32	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(conf_def.obj)	1	
Error	LNK2019	unresolved external symbol __imp__stat64i32 referenced in function file_open	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(loader_file.obj)	1	
Error	LNK2001	unresolved external symbol __imp__strdup	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(conf_lib.obj)	1	
Error	LNK2019	unresolved external symbol __imp__strdup referenced in function OPENSSL_config	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(conf_sap.obj)	1	
Error	LNK2001	unresolved external symbol __imp__time64	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(a_time.obj)	1	
Error	LNK2001	unresolved external symbol __imp__time64	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(x509_vfy.obj)	1	
Error	LNK2019	unresolved external symbol __imp__time64 referenced in function RAND_DRBG_bytes	ntfstool	E:\Code\cpp\ntfstool-master\libcrypto_static.lib(drbg_lib.obj)	1	

How can I properly import the necessary third-party libraries to the project ntfstools?

@thewhiteninja
Copy link
Owner

thewhiteninja commented Jun 25, 2021

I think the simplest way is:

  • Install vcpkg as described here: vcpkg#getting-started

    git clone https://github.com/microsoft/vcpkg
    \vcpkg\bootstrap-vcpkg.bat

  • Add it to VisualStudio

    vcpkg integrate install

  • Build the project! (VisualStudio will detect the vcpkg.json and install required packages).

@lonecrane
Copy link
Author

@thewhiteninja Cool! It works! Thanks a lot for this guideline and for this repository.

@thewhiteninja thewhiteninja added the documentation Improvements or additions to documentation label Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants