简体   繁体   English

为什么我不能在 Visual Studio 中自动创建定义文件?

[英]Why can't I automatically create definition files in Visual Studio?

I am making my first steps in C++ and after creating a class header file I want to automatically create a definition file by pressing Ctrl+., but Visual Studio tells me that it couldn't create one.我在 C++ 中迈出第一步,在创建类头文件后,我想通过按 Ctrl+. 自动创建一个定义文件,但 Visual Studio 告诉我它无法创建一个。 I always have to manually create one and then it works.我总是必须手动创建一个然后它才能工作。 Also, when I put the headers and source files in separate folders, Visual Studio tells me that the file is write protected.此外,当我将标头文件和源文件放在不同的文件夹中时,Visual Studio 会告诉我该文件已被写保护。 All files are located in my profile folder, so there should be no write protection.所有文件都位于我的个人资料文件夹中,因此应该没有写保护。

Any ideas why this could be?任何想法为什么会这样?

I suggest you could refer to the Doc: Create Declaration / Definition我建议您可以参考文档: 创建声明/定义

When: You have a function that needs a declaration, or vice-versa.何时:您有一个需要声明的 function,反之亦然。

As far as I'm concerned, first of all, you should have a function that needs a declaration.就我而言,首先,您应该有一个需要声明的 function。

Simply because Visual studio is just total garbage compared to Clion.仅仅是因为与 Clion 相比,Visual Studio 完全是垃圾。 Unfortunately I am forced to use it,so I have to spend atleast 2 hours to fix those things and write declarations manually and that process is quite slow since I'm new to C++.不幸的是,我被迫使用它,所以我必须至少花费 2 个小时来修复这些问题并手动编写声明,而且这个过程非常缓慢,因为我是 C++ 的新手。 Wouldn't recommend it to my worst enemy.不会推荐给我最大的敌人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么即使我没有要求,Visual Studio 2010 也会创建预编译的 header 文件? - Why does Visual Studio 2010 create precompiled header files even if I don't ask for it? 为什么我不能在 Visual Studio 代码上使用 gcc? - why can't i use gcc on visual studio code? 为什么我不能在Visual Studio 2013中调用CTime :: GetAsDBTIMESTAMP? - Why can't I call CTime::GetAsDBTIMESTAMP with Visual Studio 2013? 无法在 Visual Studio 中运行 Bash 中的文件 - Can't run files in Bash in Visual Studio Visual Studio无法看到.cpp文件 - Visual Studio can't see .cpp files 无法使用 Visual Studio 生成 CMake 文件 - Can't generate CMake files with Visual Studio Visual Studio C++ ofstream不能creat.txt文件但是可以创建其他类型 - Visual Studio C++ ofstream can't creat .txt files but it can create other types 为什么Visual Studio编译器无法在智能感知能找到某些头文件? - Why can't the visual studio compiler find certain header files while intellisense can? 两个文件包含main()Visual Studio的定义? - Two files containing definition of main() Visual Studio? 为什么不能在与类定义相同的名称空间中创建C ++类的实例? - Why Can't I create an instance of a C++ class defined in the same namespace as the class definition?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM