Sign in to follow this  
Followers 0
DatMCEyeBall

Help for Visual Studio 2012

9 posts in this topic

#1 ·  Posted (edited)

I wrote a quick program in Managed C++ (CLR), when I compile it, it works on windows 7 and vista but when I try to run it on windows XP I get:

66akgz.jpg

Any reason why this happens?

I'm using visual studio 2012, but I might try 2010 to see if that fixes the problem.

Here's the code:

// The following example codes demonstrate retrieving email from Gmail IMAP4 server
// To get full sample projects, please download and install EAGetMail on your machine.
// To run it correctly, please change email server, user, password, folder, file name value to yours

#include "stdafx.h" 

using namespace System; 
using namespace System::IO; 

// Add EAGetMail namespace
using namespace EAGetMail;

int main(array<System::String ^> ^args) 
{ 
    // Create a folder named "inbox" under current directory
    // to save the email retrieved.
    String ^curpath = Directory::GetCurrentDirectory(); 
    String ^mailbox = String::Format("{0}\\inbox", curpath); 

    // If the folder is not existed, create it.
    if (!Directory::Exists(mailbox)) 
    { 
        Directory::CreateDirectory(mailbox); 
    } 

    // Gmail IMAP server is "imap.gmail.com"
    MailServer ^oServer = gcnew MailServer("imap.gmail.com", 
        "someuser@gmail.com", "thisisnotapassword", ServerProtocol::Imap4 ); 
    MailClient ^oClient = gcnew MailClient("TryIt"); 

    // Enable SSL connection
    oServer->SSLConnection = true; 

    // Set 993 IMAP4 SSL port
    oServer->Port = 993; 

    try 
    { 
        oClient->Connect(oServer); 
        array<MailInfo^> ^infos = oClient->GetMailInfos(); 
        for (int i = 0; i < infos->Length; i++) 
        { 
            MailInfo ^info = infos[i]; 
            Console::WriteLine("Index: {0}; Size: {1}; UIDL: {2}", 
                info->Index, info->Size, info->UIDL); 

            // Receive email from Gmail IMAP server
            Mail ^oMail = oClient->GetMail(info); 

            Console::WriteLine("From: {0}", oMail->From->ToString()); 
            Console::WriteLine("Subject: {0}\r\n", oMail->Subject); 

            // Generate an email file name based on date time.
            System::DateTime d = System::DateTime::Now; 
            System::Globalization::CultureInfo ^cur = gcnew 
                System::Globalization::CultureInfo("en-US"); 
            String ^sdate = d.ToString("yyyyMMddHHmmss", cur); 
            String ^fileName = String::Format("{0}\\{1}{2}{3}.eml", 
                mailbox, sdate, d.Millisecond.ToString("d3"), i); 

            // Save email to local disk
            oMail->SaveAs(fileName, true); 

            // Mark email as deleted from Gmail IMAP4 server.
            oClient->Delete(info); 
        } 

        // Quit and pure emails marked as deleted from Gmail IMAP4 server.
        oClient->Quit(); 
    } 
    catch (Exception ^ep) 
    { 
        Console::WriteLine(ep->Message); 
    } 

    return 0; 
}  

EDIT:

I accidentally put my password so anyone can read my emails..fixed. 

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites



You need to install the VS 2012 runtime redistributables on your XP machine.

Share this post


Link to post
Share on other sites

You need to install the VS 2012 runtime redistributables on your XP machine.

Is there a way to do this if the target machine(s) don't have the VS 2012 runtime redistributables, or do the owners have to install them?


"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites

I don't know exact steps, but if you distribute your app with an installer, you could have the installer install the required runtimes. Otherwise, no, the owner has to install them.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Actually, I think you could also statically link the runtime to your EXE. That would be in your project settings somewhere. I haven't built any EXEs with VS 2012 so I can't say where that option is exactly, or if you actually can do that. I've done it with DLLs, that's all.

Edited by wraithdu

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This page on mdsn explains it, but thanks anyways!

Actually, I think you could also statically link the runtime to your EXE. That would be in your project settings somewhere. I haven't built any EXEs with VS 2012 so I can't say where that option is exactly.

 
Well, what version of VS do you use?
Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites

VS 2012 on Win 8.

Your link shows how to change the required platform, but doesn't integrate or install it. The target machine will still have to have what you're requiring.

Better thread that explains more about the Runtime Library and /MD versus /MT.

http://stackoverflow.com/questions/14749662/microsoft-visual-studio-c-c-runtime-library-static-dynamic-linking

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

So how is AutoIT compiled to run without any Runtimes?

AutoIt is written in native (unmanaged) C++

As for your problem, have you checked the .NET runtime version that you're targeting? VS2012 targets .NET 4.5 by default, but Windows XP only supports up to 4.0. You may need to change the targeted runtime in your project.

Edited by Unsigned

LA-based actor, part-time freelance security analyst and assembly/C/C++ kernel developer. (Extra cash is goooood.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0