C++/构建项目出错

C++/ build project got errors

本文关键字:出错 项目 构建 C++      更新时间:2023-10-16

我在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:UsersAdamshDocumentsVisual Studio 2010ProjectsInterDebugInter.exe', Symbols loaded.
'Inter.exe': Loaded 'C:WindowsSystem32ntdll.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:WindowsSystem32kernel32.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:WindowsSystem32msvcp100d.dll', Symbols loaded.
'Inter.exe': Loaded 'C:WindowsSystem32msvcr100d.dll', Symbols loaded.
The program '[3636] Inter.exe: Native' has exited with code 0 (0x0).

我该如何解决它?

AFAICS 作为特定于视觉C++的程序在技术上没有任何问题。

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

特别是,将您的视觉C++替换为特定且无可救药的无意义的怪物

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

使用标准C++

int main()

若要调试程序,请在 Visual Studio 中选择"调试"版本而不是"发布"。

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