Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I’m using the MS Visual C++ 2010 IDE on Windows 7 to compile C++ code.
I need to install the compiled code in a specific directory (C:\Users\username\somefolder). What is the best way to set this output directory?
I ran Visual C++ as administrator, opened my *.sln project, checked the expert settings and browsed to the path in the Output Directory of the Configuration Properties. Unfortunately, the code did not build in the right directory but under Program Files (probably because Visual C++ starts at an other directory for the specified relative path). Copying the absolute directory does not work.
Could someone point out how I should change this output directory in C:\Users\username\somefolder?
In the project file I can only find an 'OutputDirectory', not an 'OutputPath', so I did not risk to change this yet as I am a novice Visual C++ user.
EDIT: replacing the 'OutputDirectory' did not work or I made another mistake (cf. comments).
I would not like to move the compiled code every time I rebuild it.
Thank you in advance for the help!
The best way is to leave the compiler to build in its usual relative subdirectory and then to copy the bits you want copied in a post-build step.
This way you will always get a good build, even if the destination directory doesn't exist (or whatever reason). It also means you can still copy the files elsewhere if you change your build system - eg you build on a server that does CI for you.
Also - always specify username as the environment variable path, not a fixed user or no one else will be able to build your project successfully.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am a beginner to Windows API, and trying to learn how to make applications and such. I got to this part in the winprog.org articles, where the author started using resource files. I have written the resource file, in the .rc format. I compile it using the rc command, and it compiles into a .res file. Then I pass it off to the linker along with the the main object file, again, all from the command line. But when I run the linked executable, it does not show me the menu I defined in the resource file. Nor the icon I specified in there.
I am using Visual Studio Code instead of Visual Studio, partly to get comfortable with the MSVC CLI, and partly because I just like VSCode better. I also don't want to install additional C/C++ compilers when I already have MSVC.
So,
How should I go about compiling and linking the resource file correctly?
Are there any more up-to-date and not nightmarish methods to learn how to work with the Windows API?
You compile the resource script using the Resource Compiler (rc.exe) and pass its output on to the linker. There is no other magic involved.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
This question may seem stupid, but as a beginner I did encounter this question when I moved forward, and I couldn’t find any information.
https://upload.cc/i1/2020/12/30/rUEC9s.png
https://upload.cc/i1/2020/12/30/d7Gwbr.png
https://upload.cc/i1/2020/12/30/6vr3lQ.png
This is an open source C++ program, I tried to compile and run it, but it failed
I have the following confusion:
Why the program does not have main.cpp
Update: When asking the first question, I even forgot helloworld.cpp, sorry
How do I compile and run it with CLion
Update: Usually I create a new project. After I create the project, it seems that it can be compiled and run for granted, but I don’t know how to compile and run an existing project (from others).
What do the folders in the first picture usually refer to
What does cmake and CMakeList.txt mean?
This open source program calls opencv, fftw and other libraries. I downloaded the corresponding files on the official website. How should the program call these libraries next?
If I download the library package on the official website, how should I install or configure it; if I install the package using homebrew, does that mean I have already configured it? Or I just finished downloading
I have written some programs in c++ and qt, but I don’t seem to know anything about c++
Finally, there is really nothing in the readme of this project
Your questions are too broad. Generally speaking, the answers would be something like this:
Naming your main file main.cpp is a convention, but is not required. What is required is a main() function (More info here).
You have to configure CLion to open Makefiles. There is a tutorial in CLion's website (Here).
What documents do you refer to?
src: Naming convention to the folder where the source (.cpp) files go.
include: Naming convention where the header (.hpp) files go.
License.txt: Where the software's license is written.
readme.md: Document that gives information about the project.
tests: Files to test the software.
cmake is a tool designed to build and package software (Their website is here). CMakeLists.txt is the file CMake uses to know how to create a Makefile and build the program.
You have to make the system know where the libraries are. You can achieve this by adding them to the project's folder or by adding them to the PATH of your compiler.
If you don't know very much about of C++ you should probably search a good C++ textbook. However, remember that Makefiles and C++ are 2 completely different things.
Most open source programs have build instructions somewhere in the readme.
It is usually best to follow those, even if they require downloading unfamiliar tools.
If the project doesn't have (detailed) build instructions, you should ask the owner, to add (more detailed) build instructions(by for example creating an issue for git-based repositories).
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 5 years ago.
Improve this question
I use Visual Studio 2017 Community for C++ coding. I have made a simple win32 console app and do not want to expose my code. I have also found the .exe file in the debug folder of the solution. When I try copying the .exe file in the Debug folder in another folder it says that the dll isn't found.I also tried copying the whole folder but the same error occurs. Please help me...I want to run my app on another computer also.
You can Generate Code Map for Solution.
Navigate to Architecture –> “Generate Code Map for Solution”
Generates a code map like:
Which shows the inter-dependency between modules and libraries.
In your case by just copying the exe, you are breaking the references to all of the required libraries. Depending on your scenario, you have two good options. Copy the entire source tree + dependencies for you project and recompile it in the new working directory or create an installer which will allow you to distribute dlls and any other required resources.
This is more complicated that one might hope. To answer the question in the title, you need Dependency Walker. (The web site doesn't mention Windows 10, but this stuff hasn't changed much recently, so don't worry about that.)
To distribute the program to another machine, you need to create a release build (the debug run-time libraries are not redistributable). Once you have done that, you will almost certainly find that the other machine already has the release run-time library, but you will need to copy other libraries.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I typically use Linux to do all of my development, but have to use Visual Studio (2013 Professional, if that matters) for the project I'm working on now. I've used Visual Studio for projects in the past, and set up multi-project solutions where there were .lib and .dll files generated and all linked together by the compiler at the end to make an executable, or several. However, I've only ever set up these projects through the strange process of setting up dependencies, adding one project's directory to another projects include directory, adding the the library to the dependent projects linked libraries, etc. I'm used to the way Eclipse does this, where it give you a list of all the projects in your working set, and you can select what projects a given one is dependent on, and it will set all of this up for me. I've searched around and found nothing on how to do this simply in Visual Studio like I can in Eclipse. Is there no way to simply automate this task without resorting to the extreme of writing my own add-on, or is there one like this already in existence that I've yet to find?
Edit: I am referring to C++ projects
You must add a project-to-project reference in:
Common Properties/Framework and References
According to Microsoft, adding the Reference in Framework and References is the preferred method in Visual Studio 2010 and later. More info here: http://blogs.msdn.com/b/vcblog/archive/2010/02/16/project-settings-changes-with-vs2010.aspx
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 have a Visual Studio solution in C++ containing 27 projects with known build order and everything else, I can successfully build entire solution and everything works fine, As you know after building each project some files will produce in "Debug" (or "release") folder and I access to them for each project, 26 projects of this solution needs no change, I just want to change one project, So I just wondered if I can use produced debug files of all 26 other projects and build my solution again in Visual Studio or any other IDE?
Thank you so much
The 'debug files' of visual studios are *.pdb files and are a proprietary MS format and therefore cannot be used in other IDEs:
What is the structure of a PDB file?
The intermediate files of VS '*.obj' are generated for every translation unit but a conversion to another compiler is not achievable in an easy way:
Is there a tool that can convert a Visual Studio object file to GCC format?
If you already have the VS solution you can make changes to the project you want to edit and VS will ensure that every project that needs a change will be recompiled and linked if you build the solution.
If you want to spare time you can tell VS compile the project you are working on instead the entire solution. You might stay with VS if that works for you.
Adding support for another build-system or IDE should be done by an experienced developer who is familiar with those projects.
In theory, Visual studio will spot what has changed (in a solution) and just saying build should just build what has changed (and its dependencies).
Beware if using the libraries and exes from one compiler with those of another - you almost certainly need to use the same version of Visual Studio, since for example the implementations of the stl will change between version.
Furthermore, if you use a different compiler things will almost certainly go horribly wrong.
If you use another IDE and point it to the same compiler, things should be ok.
edit
If by "another IDE" you mean another instance of the same IDE, i.e. you want to open a different solution, but use this as a "library" that's fine. You don't need the .obj files - they are part of the build process. It's the final .lib or .dll files you need, together with .pdb files if you want the debug symbols.