Debugging .exe file using VCEXPRESS and an existing Visual Studio solution - c++

I have a .EXE file which I need to debug using VCEXPRESS using the code in an existing Visual Studio solution (.sln). Basically I trying to do something like this:
VCEXPRESS.EXE program.exe -use project.sln
I know I can do this
VCEXPRESS.EXE program.exe code.cpp
But then I may not be able to navigate through the whole code as VCEXPRESS only sees code.cpp. and also the .exe file contains the code in the solution plus some extra code. Is there is a way to achieve what I am trying or anything similar to it?
I would really appreciate your help.

I debug it using different VS versions. One workaround I could think of is using the /DebugExe, but it doesn't work if I use the Express version since it has many limitations in command line.
https://msdn.microsoft.com/en-us/library/ms241274.aspx
But if I use the VS2015 community version which was also free in command line, I could debug the specified executable file. Would you please use the high VS version like the community which is also free and it has much more features than express version.
If I have misunderstood this issue, please feel free to let me know.

I solved it. The solution is to open the VS solution and use visual studio commands to add the .exe file as an existing project. It will be something like this
VCEXPRESS.EXE solution.sln /COMMAND "File.AddExistingProject program.exe"
You can also open a source code file like this
VCEXPRESS.EXE solution.sln code.cpp /COMMAND "File.AddExistingProject program.exe"
This will open the solution and code.cpp in the editor, then add program.exe as an existing project and allows you to debug it.
I hope someone in the future finds this answer useful.

Related

How to compile and run C++ code in VS Code easily?

So I just got into using VS Code. I am currently working with C++ and I am using Mingw as my compiler. So far I have been using the terminal at the bottom of VS Code to compile and run like this:
g++ program.cpp then doing ./program.exe
The process of using the terminal at the bottom is time consuming especially when I need to compile and run code frequently. This is also annoying when creating classes when you have to compile multiple files into .o extensions etc.
Can anyone help with this process? Am I doing something wrong, should there be an easier way? Maybe a makefile?
Thanks!
If you want to compile and run C++ code in visual studio code(Vs-code) in windows. This include following steps.
Download Visual studio code.
Go on Add extension Type C++ and install "C/C++" by Microsoft.
Go to Visual Code studio docs for "C++" OR https://code.visualstudio.com/docs/languages/cpp
Install MinGW-x64 vis MSYS2 website and run this on shell "pacman -S --needed base-devel mingw-w64-x86_64-toolchain"
Then go to windows setting and look for Edit environment variables for your account. Then in advance settings >> Environment Variable.
In "system variable" choose path and edit it and add a new path.
You can find a new path in your directory where you have installed the MinGW-x64. you might find it in C:\msys64\mingw64\bin. or where ever you have installed it.
When you have added the new path then go to any shell/cmd and Type g++ --version
if you get the version then you have succeded.
If you find something like command not recognized then please check where you have done wrong or skipped any step.
Otherwise startover.
thanks--

I don't see the "Publish" button. How to make standalone exe-file from C++ code?

Problem is the same as here:
Visual Studio 2017 - Not Able to see Publish - Missing Profile / Deployment Options
https://developercommunity.visualstudio.com/content/problem/129404/missing-publish-menu-in-netcore-web-project-right.html
except the fact that I didn't see the button earlier (I've started coding in Visual Studio just recently). I've installed some packages, which were adviced in mentioned topics, like "Azure" and "ASP.NET", but it didn't solve the problem. I don't understand, how it could help (I code on C++ and have not to use these packages, do I?) and what exactly I should do (maybe I've downloaded something wrong).
Thank you in advance!
Update
If I understand right, there is no way to "publish" C++ code, according to:
https://social.msdn.microsoft.com/Forums/en-US/6998eadb-36fb-4a97-bba5-0de49d533732/how-can-i-publish-a-visual-c-project-?forum=vsclassdesigner
Then, how to make standalone exe-file, that doesn't require something other like .pdb, .ipdb and .iobj and can be run on another coumputer without Visual Studio?
The command that creates the binary is called "Build".
I can't say for sure, but I think that "Debug" builds to run on another computer need vcredist, while "Release" builds can run without anything else. Again, I am not sure.

building curl 7.46.0 on windows without cmd

curl being new to me, I am figuring out an easier way to compile it on Windows. I've managed to find a good documentation explaining in layman's terms all the steps, however this doc is based on curl-7.9.6.
It was simpler since curllib.dsw which is the Visual Studio Project file for curllib was found in folder curl-7.9.6\lib. So building it was resulting in libcurl.dll + libcurl.lib
Unfortunately this project file is no more in the latest version 7.46.0, and I would not like to mess around using other techniques I am not familiar with, compiler other than msvc (e.g MinGw), and if possible without resorting to cmd.
I have already done some researches online before posting this thread, but we never know maybe someone has written on this topic very simple documentation that everyone could understand and willing to share it publicly to get both the static library file and DLL (raised just above) or have found a way to get back the project file (.dsw) in the latest release which will a priori be straightforward to compile using Visual Studio 2013 (v120)
Best

Using Visual Studio 6 C++ compiler from within Emacs

I'm just getting started with c++ development and I would like to use emacs to write the code and then compile and run it from within emacs using the visual studio 6 compiler. I have already googled around a bit but just can't seem to find an explanation of how this is done.
Any pointers?
Thanks for your help,
joerg
I have done this as a matter of course over the past few years. There are two ways to do this:
In the older versions of VS (including VS 6.0), there is a button to export the nmake file for the project. I do this on occasion and then use nmake to compile. I have
(setq compile-command "nmake debug ")
in my .xemace/init.el for this. You have to add the name of the nmake file, and nmake.exe has to be in your path. (BTW, I modified compilation-error-regexp-alist-alist to help moving through the errors. Let me know if you want this as well.)
Newer versions of VS do not have the button to export the nmake file. For these I call devenv.com. In this case I have
(setq compile-command "devenv.com /build Debug ")
in my .xemacs/init.el. You have to add the name of the .sln file. Although I did not do this with VS 6.0, I believe that it may work as well.
I am not sure if you would consider merely swapping the text editor inside of Visual Studio with Emacs, but here is a sf.net project which does just that.
http://sourceforge.net/projects/visemacs/
Checkout http://www.kuro5hin.org/story/2003/4/1/21741/10470
As a followup to Andrew Stein's answer, to do a command line build on Visual Studio 6 without using nmake, use the syntax:
msdev wspname.dsw /make "project - Win32 Debug"
Visual Studio is an IDE
It uses the cl.exe compiler underneath.
We use emacs with GNU make (gmake), which is wrapped with our own gmake wrapper executable and it works very well.
Just set up simple a keybinding to invoke cl.exe on .c/.cpp files that you are compiling to build your .obj files. We have one keybinding for initializing a compile in a folder, which will make all .obj files that are not up to date, but this is purely handled by GNU make.
We also have other keybindings, e.g. for linking the executable and starting it etc.
A bit off topic, but why are you using visual studio 6? The compilers (as well as stripped down IDEs) for the current version of visual studio are available for free from Microsoft.
In either case, you can invoke the compiler from the commandline so it should be as simple as setting up a makefile.
If you just want to set up a single file to compile then put this at the top of your file...
// -*- compile-command:"g++ test.cpp -g -lwinmm -o test.exe"; -*-
See my blog post on this
Of course you need to adjust to use CL.EXE and choose the appropriate arguments.
For launching make it's a bit trickier since you have to run make as if you were in the parent source directory, when you are editing a file further down the hierarchy.
The only way I know of to do that is to put this at the top of every file ...
// -*- compile-command:"nmake"; default-directory:"c:/projectroot/"; -*-

How to use Microsoft C++ compiler with NetBeans?

I was wondering whether it's possible to use Microsoft's C++ compiler and linker with NetBeans IDE?
If so, what's the best way of doing it.
P.S. I'm not interested in Mingw.
EDIT: Is it possible to get NetBeans to do error parsing (so that I can click on error and have NetBeans open the right file), intellisense, etc? I know NetBeans can work with g++ make files. Why not with nmake?
I am currently writing a plugin/toolchain to use Visual C++ on Netbeans.
You can find the project called VCC4N on source forge or on NetBeans plugins.
To be honest, I always do my spare time coding inside an ide (e.g. code::blocks, monodevelop, anjuta) or an editor (virtually always scite), and the compiling I do in a terminal via a makefile (handwritten, cmake, automake).
This isn't really a problem w.r.t. time to compile: F7 (or some other of the F keys) vs. (alt+tab, up, enter), where (alt+tab) and (up) are pressed nearly at the same time, but I get the great benefit of having up to full screen compiler reports, and often I am anyways testing my programs in a terminal. Also, it makes my code more independent of the IDE (ever tried to get a makefile from code::blocks for distribution purposes?).
The visual studio compiler is called cl.exe and the linker is link.exe. These are present in particular visual studio directories. From inside visual studio > project properties > C++ > Command Line, or by disabling "Suppress Banner" option there, you can find the command that visual studio runs. You can call these command lines from inside netbeans.
Getting all the file names into the list to compile may be more tricky. You need a build system for this. You can try to use the same mechanism that visual studio uses, but sorry my knowledge fails there. Alternatively, you can use CMake or some other build system. Then, whenever you add/delete a source file, you would have to update the CMakelist.txt to be able to compile.
You can get syntax highlighting, code graphing etc from netbeans without having a compiler installed I think (not certain, you may need cygwin or mingw for parsing). What you must do is create at least an empty makefile. If you want to use Microsoft's compiler then you either need to:
a) Write the makefile yourself to compile eveything using cl
b) Call on msdev from the makefile with the project name and it will compile everything
b) Call something like scons from the makefile to compile everything
I use netbeans to develop cross platform software, at this time though, I don't actually run the builds from netbeans.