Thread: Issues Compiling on Windows 10

  1. #1
    Registered User Art3mis's Avatar
    Join Date
    Jun 2016
    Location
    United Kingdom
    Posts
    3

    Issues Compiling on Windows 10

    Hi,

    This is my first post!

    I mainly program in Python, with a bit of Visual Basic. I've recently taken an interest in C++.

    I'm having an issue compiling even the most basic program on my system. I've tried using MinGW and Visual C++ compilers, but the same issue arises.

    Trying to compile this, the most basic program, all I get is a blank Command Prompt window with a flashing cursor.

    Code:
    #include <iostream>
    
    using namespace std;
    
    void main()
    {
        cout << "Hello, World!" << endl;
        cin.get();
    }
    The line "Hello, World!" doesn't print and the program seems to hang. When I try to re-run I get a Permission Denied error.Closing the Command Prompt window leaves the process running in memory.

    It doesn't show in Task Manager, but when I run Tasklist
    from Command Prompt I see the process, which I need to kill using
    Code:
    Taskkill /PID {id-no} /F.
    As I said, I've tried using other compilers. I've also tried changing the write permissions in the directory the application is running from. I've even excluded the directory from my AntiVirus as I've read this can be an issue.

    So. I'm stuck with this seemingly simple issue, with the solution probably staring me in the face, but I can't seem to see the wood for the trees.

    Maybe an outside perspective will reveal a solution?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Art3mis
    I've also tried changing the write permissions in the directory the application is running from.
    What about the permissions of the executable file itself?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User Art3mis's Avatar
    Join Date
    Jun 2016
    Location
    United Kingdom
    Posts
    3
    Quote Originally Posted by laserlight View Post
    What about the permissions of the executable file itself?
    Tried that too. Using the VS2015 C++ compiler I can see the compilation seems to have been successful; there are no errors returned, and both the object file and the executable are there.

    If I navigate to the directory using Explorer and try to execute the .exe file Explorer hangs and I have to restart.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    It's possible that your antivirus software is blocking it. Some watch for any .exe file to change, and block access.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    Guest
    Guest
    It's generally a terrible idea, but have you tried running the shell in Admin mode to see if it runs fine then? Because if that doesn't work, then maybe the error message hides another problem.

    Edit: e.g. such as what Elkvis suggests.

  6. #6
    Registered User Art3mis's Avatar
    Join Date
    Jun 2016
    Location
    United Kingdom
    Posts
    3
    Quote Originally Posted by Elkvis View Post
    It's possible that your antivirus software is blocking it. Some watch for any .exe file to change, and block access.
    So simple, yet so elusive!

    I think that's exactly what's happening. Even though I'd added an exclusion to the directory it was still blocking the .exe. I had to explicitly uncheck the scanning of .exe files when opening in the AV software.

    Not sure how safe that is, but the code runs!

    Thanks guys!

    Appreciate the help.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Glad I could help.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Btw, main should return int, not void.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issues compiling with static - linker missing .o files?
    By shrink_tubing in forum C++ Programming
    Replies: 6
    Last Post: 03-15-2011, 03:00 AM
  2. Compiling for Windows
    By markaizer in forum C Programming
    Replies: 3
    Last Post: 05-21-2010, 10:41 AM
  3. Issues compiling multiple c files.
    By Overworked_PhD in forum C Programming
    Replies: 2
    Last Post: 10-11-2009, 04:25 PM
  4. Compiling Issues
    By pc_doctor in forum C Programming
    Replies: 3
    Last Post: 11-30-2007, 10:00 AM
  5. compiling issues..please help
    By zwoodjroz in forum C++ Programming
    Replies: 5
    Last Post: 04-22-2007, 01:35 PM

Tags for this Thread