Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

C++ insert dll into executable file

Using visual studio 2017, when creating exe its also generating libcurl and some other dlls into folder.Possible to insert every dll file into exe ?

PHP Code

<?php 
#include "stdafx.h"
#include <string>
#include <iostream>
#include <boost/filesystem.hpp>
#include "boost/algorithm/string.hpp"
#include <cpr/cpr.h>
#include <fstream>
#include <vector>
#include <random>




//this func definitely working
std::string random_string(std::string keys, int length)
{
 
std::string str(keys);
 
std::random_device rd;
 
std::mt19937 generator(rd());
 
std::shuffle(str.begin(), str.end(), generator);
 return 
str.substr(0, length);
}


int main() {
 
std::cout << "test";

} 


Visual Studio 2017 -

Codes works perfectly with "Multi-threaded Debug DLL (/MDd)" option.
But when trying to make one "Multi-threaded (/MT)" getting these errors;




PHP Code

<?php 
1
>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>Test.cpp
1
>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>Test.obj : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(xonce.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(syserror.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1
>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(xwcsxfrm.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol __free_dbg
1
>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(xwcsxfrm.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol __malloc_dbg
1
>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype
1
>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol __calloc_dbg
1
>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol __calloc_dbg
1
>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol __calloc_dbg
1
>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __wcsdup_dbg referenced in function __Getctype
1
>libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol __wcsdup_dbg
1
>libcpmtd.lib(locale.obj) : error LNK2019: unresolved external symbol __realloc_dbg referenced in function "private: static void __cdecl std::locale::_Locimp::_Locimp_Addfac(class std::locale::_Locimp *,class std::locale::facet *,unsigned int)" (?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z)
1>C:\Users\p\source\repos\Test\Debug\Test.exe : fatal error LNK1120: 6 unresolved externals
1
>Done building project "Test.vcxproj" -- FAILED.
========== 
Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 


I want to put everything into one executable file on every page google says you need to compile it with "Multi-threaded (/MT)" but that damn fuck not let me to do.Tried everything on google nothing fix problem .. So ANYONE ? 🤮 🤮 🤮 🤮 🤮 🤮
What curl release are you using? I don't really understand your problem here. If you see .lib and .dll files that is normal. If you're having problems setting up the latest curl release and linking it to your project try this.

Check your projects configuration settings in Project | Properties | Configuration Properties set PATH=$(ExecutablePath)$(LocalDebuggerEnvironment). You could always just call your library manually in your project

Code
#include "stadfx.h"
#include <curl/curl.h>

void main(int argc, char* argv[])
{
   CURL *curl = curl_init();
   if(curl) printf("curl_init success\n");
   else fprintf(stderr, "Error calling curl_init().\n");
}
(Dec 11, 2018 09:17 AM)Europa Wrote:  What curl release are you using? I don't really understand your problem here. If you see .lib and .dll files that is normal. If you're having problems setting up the latest curl release and linking it to your project try this.

Check your projects configuration settings in Project | Properties | Configuration Properties set PATH=$(ExecutablePath)$(LocalDebuggerEnvironment). You could always just call your library manually in your project

Code
#include "stadfx.h"
#include <curl/curl.h>

void main(int argc, char* argv[])
{
   CURL *curl = curl_init();
   if(curl) printf("curl_init success\n");
   else fprintf(stderr, "Error calling curl_init().\n");
}

updated question with codes and debug output.
Have you thought about static linking those libraries?
Like the person above has stated statically link your libraries and ensure you have the required VS2017 redistributables then do a clean rebuild. Make sure your debug mode is set to non-debug as well. Also the linker includes libaries that you don't need so perhaps try this:

Project Properties -> Linker -> Input -> Ignore specific libraries -> ignore ibcpmtd.lib
None of them worked, so basically i fucking delete cpr library and now using win sockets to connect lol.Thanks guys ..


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Transporter007May 26, 2023 06:22 PM 22 665 May 26, 2023 06:22 PM
Last Post: Smoky
[C#] by indetectableFeb 17, 2022 06:12 AM 15 638 Feb 17, 2022 06:12 AM
Last Post: indetectable
[.NET] by lans.007Apr 10, 2021 12:43 PM 5 265 Apr 10, 2021 12:43 PM
Last Post: Exploit-Tool