Showing posts with label Visual Studio 2010. Show all posts
Showing posts with label Visual Studio 2010. Show all posts

Saturday, September 29, 2012

Pause Console Application in the End

If you want to pause your Visual Studio console application in the end, there is no need to insert something like Console.ReadKey(). If you run your application with Ctrl-F5 (Run without Debug) then Visual Studio creates and runs a batch file that look something like that:
your_program.exe
@pause
So, command line will pause with "Press any key to continue..." message when your program is done and you will be able to examine the output.

Input Arguments for Console Application in VS

If you want to run your console application from Visual Studio (Ctrl-F5) and you need some input arguments that you need to specify them in Project -> Properties -> Debug -> Start Options -> Command line arguments.

Sunday, February 26, 2012

How to Port PThread-Win32

Finally got it!
  1. Put your .h files (pthread.h, semaphore.h, sched.h) into $Visual_Studio/VC/include.
  2. pthreadVC1.dll goes to C:/Windows. Not the best idea but I am out of time and this works.
  3. pthreadVC1.lib goes to $Visual_Studio/VC/lib. Also, include it in the Linker. Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies. Add there pthreadVC1.lib.
These actions should eliminate all external linking errors. Although, you may still have problems when you run the application. I got the error: pthreadVC1.dll missing. In this case, put pthreadVC1.dll into C:/Windows/SysWOW64 where all other dlls are (like kernel32.dll). Probably it is a better solution to start with.

Also, use Sleep() for Windows (add #include <Windows.h>) and sleep() (add #include <unistd.h>) for UNIX-based systems.