I have my exe file compiled by Visual studio, I am coding in c++ and I can debug and run my code correctly with the correct additional dependencies and working directory.
I would get The procedure entry point could not be located in the dynamic link library
I get that it could not find the main func of the dll file leading to this meaning my exe could not find the dll file. Problem is I had this error before in visual studio and I set the working directory to OutDir which fixed it but the stand alone exe file would still give the error
I have used LoadLibrary and I do not get why it doesnt work, it should find the path
note: my dll are correct version, latest update, is the required format and located in a folder named [binary] which is next to my exe
#define NOMINMAX
#include <iostream>
#include <string>
#include <windows.h>
#include <sfml/graphics.hpp>
static void DLLErrorHandler(HMODULE& DLL1, HMODULE& DLL2, HMODULE& DLL3, HMODULE& DLL4, HMODULE& DLL5, HMODULE& DLL6) {
DLL1 = LoadLibrary(L".\binary\openal32.dll");
DLL2 = LoadLibrary(L".\binary\sfml-audio-d-2.dll");
DLL3 = LoadLibrary(L".\binary\sfml-graphics-d-2.dll");
DLL4 = LoadLibrary(L".\binary\sfml-network-d-2.dll");
DLL5 = LoadLibrary(L".\binary\sfml-system-d-2.dll");
DLL6 = LoadLibrary(L".\binary\sfml-window-d-2.dll");
switch (0) {
case 0:
if (DLL1 == NULL) MessageBox(NULL, L"Missing DLL: openai32.dll", L"Error", MB_ICONERROR | MB_OK);
case 1:
if (DLL2 == NULL) MessageBox(NULL, L"Missing DLL: sfml-audio-d-2.dll", L"Error", MB_ICONERROR | MB_OK);
case 2:
if (DLL3 == NULL) MessageBox(NULL, L"Missing DLL: sfml-graphics-d-2.dll", L"Error", MB_ICONERROR | MB_OK);
case 3:
if (DLL4 == NULL) MessageBox(NULL, L"Missing DLL: sfml-network-d-2.dll", L"Error", MB_ICONERROR | MB_OK);
case 4:
if (DLL5 == NULL) MessageBox(NULL, L"Missing DLL: sfml-system-d-2.dll", L"Error", MB_ICONERROR | MB_OK);
case 5:
if (DLL6 == NULL) MessageBox(NULL, L"Missing DLL: sfml-window-d-2.dll", L"Error", MB_ICONERROR | MB_OK);
default:
if (DLL1 != NULL && DLL2 != NULL && DLL3 != NULL && DLL4 != NULL && DLL5 != NULL && DLL6 != NULL){
std::cout << "DLL files loaded!";
}
else {
exit(1);
}
}
}
static void DLLrelease(HMODULE& DLL1, HMODULE& DLL2, HMODULE& DLL3, HMODULE& DLL4, HMODULE& DLL5, HMODULE& DLL6) {
FreeLibrary(DLL1);
FreeLibrary(DLL2);
FreeLibrary(DLL3);
FreeLibrary(DLL4);
FreeLibrary(DLL5);
FreeLibrary(DLL6);
}
int main() {
HMODULE DLL1, DLL2, DLL3, DLL4, DLL5, DLL6;
DLLErrorHandler(DLL1, DLL2, DLL3, DLL4, DLL5, DLL6);
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window");
sf::CircleShape bicycle(20.f);
bicycle.setFillColor(sf::Color::Blue);
bicycle.setPosition(400.f, 300.f);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
else if (event.type == sf::Event::MouseButtonPressed) {
if (event.mouseButton.button == sf::Mouse::Left) {
sf::Vector2i mousePosition = sf::Mouse::getPosition(window);
bicycle.setPosition(static_cast<float>(mousePosition.x), static_cast<float>(mousePosition.y));
}
}
}
// Clear window
window.clear(sf::Color::White);
// Draw objects
window.draw(bicycle);
// Display window contents
window.display();
}
DLLrelease(DLL1, DLL2, DLL3, DLL4, DLL5, DLL6);
return 0;
}
I have done correct linkage and everything, all run smoothly on visual studio when debugging mode in x64 but when I double click my stand alone exe it says entry point not found which I do not know what to do
I would like my dll to stay in the folder and not be located next to my exe file, and I want my exe to recognise that my dll files are in the [binary] folde next to it and do not need to add system PATH cus if I want to distribute it, it would not work.
Note: I am new to dll files and linkage and stuff so I would really want to learn dynamically linking, static link would not be preferred but any education from you guys would be appreciated
Note: This is the message from depends.exe{
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
}
This is my file structure:
FpsKing/
│
├── FpsKing.exe
│
└── binary/
├── openal32.dll
├── sfml-audio-d-2.dll
├── sfml-graphics-d-2.dll
├── sfml-network-d-2.dll
├── sfml-system-d-2.dll
└── sfml-window-d-2.dll