-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

インター.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 に答える