I'm developing a gcc application using Visual Studio 2015 as an IDE. The debugger is gdb.
The application creates it's own window. When I compile with a DEBUG switch, I need the application to also spawn a console window. It's used for debugging and outputing printf's from multiple threads. Thanks to the "-mwindows" switch, this works correctly when I execute the application from outside Visual Studio.
Unfortunately, when I run the application from within Visual Studio, it seem to steal the console window. No console is spawned, and the printf's output are redirected to the Output Debug window.
This wouldn't be much of a problem if the VS console actually printed the "\n" correctly instead of stripping them out of the ouput. Everything gets printed on the same line, and the output becomes unreadable. Try as I may, I couldn't get VS to insert a newline in the Output Debug window. I searched online a lot, and this problem seems to be well documented, but I couldn't find a satisfying answer.
At this point, either of these solutions would work for me :
Prevent Visual Studio from stealing the application's console window;
Add special characters to all my printf in order to make the Output Debug print line feeds and carriage returns.
EDIT :
Ideally, the solution should be cross-plateform, in a sense that it should not add dependency to WinAPI.
EDIT2 :
"\t" seems to work as intended. Why does "\n" doesn't work? I also tried "\r\n" to no avail.
I was contacted by a Senior PM Manager for Visual Studio at Microsoft regarding this issue. I posted it as a "feedback" inside Visual Studio, about four months ago (around the time I posted it here)..
He acknowledged the problem, and said they're gonna try to add support for external consoles with Update 3.
Related
I am trying to do some assembly coding, I call the functions from C language. The code itself runs fine, but I have two enormous problems that I cannot to tackle for quite a long time now. First of them is syntax-highlighting - I installed two different (one at the time) asm highlighting extensions to visual studio 2015 enterprise, both of them didn't work. Before I installed the 2015 version I had 2013 Ultimate and the highlighting worked fine there. I tried to delete specific files responsible from registry etc but it didn't help me achieve absolutely anything. Tried to reinstall or update the extensions is well.
Another problem I have is something that pretty much started happening for first time 3 hours ago, in a solution when I have an asm file it is fine, I can edit it freely, run it, whatever. But once I switch off visual studio and run it again in the moment when I try to open the asm file in visual studio the file is no longer in clean assembly but in OP codes written in hexadecimal and along it there is list of the memory cell in which each op is in... When I make new asm file in the solution it is fine but once I restart visual studio same thing happens. I tried to look through all the common options in the top menu bar but there seems not to be anything helpful to me in this situation....
Desperately I tried to google both of those things (first one for quite extended period of time) but it seems like some of the problems I have encountered could possibly be related to 2015 enterprise version of visual studio :(
EDIT// OK I MANAGED TO FIX THE SECOND PROBLEM - right click the .asm file and use Open With and choose another editor!!!
Help please ;(
AsmDude will not work when .asm files are associated with an editor (see this issue here). If you still experiencing problems with AsmDude, consider opening an issue on Github. I'm happy to help you there.
I have a GTK+3.0 project running in VS2013
I added to my linker command line options this argument:
/ENTRY:mainCRTStartup
I suspect that might be related to the fact that I have no output in VS that shows the messages printed with g_print
I also tried calling printf and see no output in VS2013's output window, nor the "immediate window"
Does anyone have experience building C projects in VS2013 that use GTK+ 3.0 that could maybe tell me where I can see the messages printed by g_print and/or printf, or perhaps can you suggest a different way to debug print?
More details about how I set up the project in VS2013:
How to configure gtk on Visual studio 2010
Error 3 error LNK1104: cannot open file 'gtk-3.lib'
Compiling a GTK3 program in Visual Studio 2012
To those who want to know..
I found the answer.
In my first link, the direction was to do the following:
While we are still in the view of the Project Properties, click on
Linker and then System. Look for SubSystem on the right and click the
drop down box. Select Windows /SUBSYSTEM:WINDOWS
If you omit this step, you get a GTK window and a console, where you can read the output of printf().
I've got AvalonEdit embedded in a WPF application. As I resize, change text, etc, it continually sends debug messages to the console output window. Messages like:
OnHighlightStateChanged forces redraw of line 13
Building line 13
Is there any way to turn these off? There are lots of them and they bury my other debug messages.
Thanks.
(I'm on Visual Studio 2013).
Are you using a debug build of AvalonEdit?
You shouldn't see these if you use a release build / the official binaries (for example, from the NuGet package).
If for some reason you need to use self-compiled debug binaries of AvalonEdit, the answer is simple: remove the Debug.WriteLine() calls from the AvalonEdit source code.
Ok, I'm at a loss.. I have never seen this happen before. I am using Visual Studio. I have been working on a regular WPF project. It was working fine. This morning, I made a few changes to add a .dll project to my solution and link directly to it. Now, I click the green arrow, or F5 to start debugging, and it clicks and then goes green again. There is no debug output, the program doesn't start running. There are no exceptions thrown. What the heck happened?
It's a pretty big project, so I can't put any useful source code here. I'm just wondering if anybody has ever had a case where they push F5 to start the app, and nothing happens..
Any help would be appreciated. I am at an utter loss as to what would cause this.
WPF apps usually just die without an error message if there is a problem during start-up.
You can try to configure your IDE to break on thrown exceptions:
Debug -> Exceptions:
Check the checkbox in the column Thrown in the row "Common Language Runtime Exceptions".
Ok, I am a blithering idiot. The problem was that I had 2 instances of Visual Studio open at the same time and on the same project. When I closed down Visual Studio, I noticed the other instance and closed it too. Then I opened just one and everything wants to work now.
So wierd, but fixed now.
Word of warning. Only open your project once.... :-)
Thanks to all for the help. You all get points !!
I'm using Windows 7 Professional (x64) and having installed .NET 4.0 RTM on my machine.
Since 2 days I'm noticing that every WPF application that I'm trying to run hangs and becomes non responsive (a not responding text is appended to it's title bar) and it's painted white.
There is no info regarding any exception, no error message. Nothing. Even the Event Log shows that there was "application hang" event (code 1002) and nothing more.
This problem is for everything that is written in WPF, even for products like NHibernate Profiler and other stuff that I was using on a regular basis without any issues.
Tried to reinstall .NET 4.0 and nothing changed. Any ideas why this might be happening?
I had the same problem. It was a corrupt font cache!!
See http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7cc032c1-5f4d-4518-adc6-f53afd051e6b for a solution.
If I had to guess I would say video drivers. It might help to try attaching Visual Studio's debugger to the hung process (Debug -> Attach to Process) making sure that Managed Code is the selected debugger type. Then you can break into the debugger and maybe see a common stack trace.