Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to place DLLs of my game to another folder then exe file because it is a huge mess. (I use SDL2 but it is not relevant for this I guess)
Edit: How can I import DLL from another direktory ? (I import them just trought headers)
For this to work you need to specify your libraries as /DELAYLOAD and set the appropriate DLL directories during application startup calling AddDllDirectory (Windows 8 and above) or SetDllDirectory (Windows XP SP1 and above).
Delay loading of DLLs is required in this scenario. Otherwise the loader will try to resolve the import tables before your application gets a chance to set the appropriate directories to search for.
The PATH environment variable should do the trick
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
I want to put an exe file in my C++ program, but I don't understand how to do it.
I am using Visual Studio 2019. I know that it can be done through project resources, but I don't know how to work with it.
Create an .rc file to refer to the desired embedded .exe as an RCDATA resource, eg:
MYEXE RCDATA "path\to\file.exe"
Add the .rc file to your project.
The referred .exe file will then be compiled into your final executable.
You can then access the MYEXE resource at runtime using the Win32 FindResource()/LoadResource()/LockResource() functions, or higher-level framework equivalent.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am sending my C++ program as a zip file. So my code is hardcoded to reference my desktop path. I would like to put these files in a different folder and then send it along with the rest of my code. How can I achieve this? Is there any sort of resource file or something? Any help would be appreciated.
It depends on your platform. There are platform-specific conventions on how to package files with an application.
If you are writing a ANSI/ISO C++ application without use of platform-specific API (like Windows or Mac API calls), those aren't really available, so the best you can do is to include a Readme file that tells your users where the files should go.
At startup, the first argument passed to your command line application would be its path, possibly relative to the current directory. So you should combine those two paths into one to get the path to your programs main executable, then add a relative path relative to your executable's path to look for the additional files.
Alternately, you could just ask your users to pass the path of the folder containing the helper files as an argument to your command line program.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm writing updater program in C++, i need extract files from them.
I'm using Microsoft Visual Studio.
What I'd like the achieve:
User runs exe
exe unpacks files
exe runs one of extracted files
Can anyone recommend a good solution?
Thanks!
Extracting resources from a file with C++:
Extract file from resource in Windows module
Self-Extracting Executable C++
http://www.codeproject.com/Articles/4221/Adding-and-extracting-binary-resources
You're writing an updater.
User runs exe
exe unpacks files
exe runs one of extracted files
So your program should:
Download the patch from the server (use a networking library like winsock or something higher-level)
Unzip the archive (depending on the format in question, there should be libraries for that, like zlib)
Move the new files and overwrite the old ones (use win32 or something higher-level like MFC or Qt)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Where do you usually install debug versions of libaries you build from sources, e.g. under /usr/local/debug, something else?
Consider a software library you use for your developing program. If you need to go into the library's source code under debugger, you need the library build without optimizations and with debug symbol generated. On the other hand, to normally run your application or estimate a performance you usually use 'release' build of the library, such builds are typically installed under /usr/local (default prefix).
thx
There is no standard answer to this.
If we assume that ${project} is the name of the relevant project - e.g llvm or jpeglib or whatever, then:
You can store the files locally in your home directory (~/${project}/...). I use the pattern /usr/local/${project}-debug/... on my home machine. At work, I have my files in /work/${project}/target-dir - where target-dir is the name of the embedded platform I built it for - since my work involves building for a variety of different platforms, and I don't want to rebuild every time.
Of course, this also means that you have to modify the linker path to take this path ahead of the "normal" install directory. Not a big problem, just add a -L~/${project}/lib or whatever you decided on. And when you run things, you may need to use LD_LIBRARY_PATH=...:${LD_LIBRARY_PATH} to ensure the correct shared library files are picked up.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
For example, if my project directory is /media/code/clojure/my-project/ and I have a file /media/code/clojure/my-project/src/foo.clj, how can I get "/media/code/clojure/my-project/" from foo.clj?
This is unfortunately not possible because the idea of a "project root" is not well defined in the Java package model. There is a the idea of "the root of the source for this project" though once/if it's compiled into a jar file this concept no longer applies, the jar file could be loaded form anywhere on the system and that location will almost always (in the case of distributed software) be a system package installation directory. This would be an inappropriate place to download files to.