-1

我在 Visual Studio 2010 中有以下 c++ 文件:

stdafx.h


// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

void printHello();
// TODO: reference additional headers your program requires here

inter.cpp

// Inter.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
{
    printHello();
}

stdafx.cpp

// stdafx.cpp : source file that includes just the standard includes
// Inter.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
#include <iostream>

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
void printHello() {
    std::cout << "Hello World!" << std::endl;  
}

我明白了:

'Inter.exe': Loaded 'C:\Users\Adamsh\Documents\Visual Studio 2010\Projects\Inter\Debug\Inter.exe', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[3636] Inter.exe: Native' has exited with code 0 (0x0).

我该如何解决?

4

1 回答 1

1

AFAICS作为 Visual C++ 特定程序,您的程序在技术上没有任何问题。

但是,它是不必要的特定于编译器的。

特别是,替换您的 Visual C++ 特定且毫无意义的怪物

int _tmain(int argc, _TCHAR* argv[])

使用标准 C++

int main()

要调试您的程序,请在 Visual Studio 中选择“调试”构建而不是“发布”。

编辑:休息室里的人评论说,对于 OP 来说,该程序可能完成得太快了?如果是这样,只需在 . 的右大括号上放置一个断点main

于 2012-04-29T18:34:38.897 回答