简体   繁体   English

我是一名学生,当我包含像 stdio.h 这样的库时,我无法在 C (visual studio) 中运行程序

[英]I'm a student and I can't run program in C (visual studio), when I include a library like stdio.h

I'm in class where we're learning C, and a few weeks ago I noticed whenever I included any library with #include<stdio.h> an error takes place.我在 class 学习 C,几周前我注意到每当我包含任何带有#include<stdio.h>的库时都会发生错误。

For this simple piece of code:对于这段简单的代码:

#include <stdio.h> 
#include <locale.h>

int main() { 
    printf("Hi"); 
    return 0; 
} 

This is the error message:这是错误消息:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)   P2ficha4    E:\Programacao1\P2\P2ficha4\P2ficha4\MSVCRTD.lib(exe_main.obj)  1   

and

Severity    Code    Description Project File    Line    Suppression State
Error   LNK1120 1 unresolved externals  P2ficha4    E:\Programacao1\P2\P2ficha4\Debug\P2ficha4.exe  1   

This has been a really big set back for me, and I don't think my professor can help me on this one.这对我来说是一个很大的挫折,我认为我的教授不能帮助我解决这个问题。 I appreciate any help我很感激任何帮助

My partion of E was disconnected from C by root.我的 E 部分已通过 root 与 C 断开连接。 I made the project in the same partion (C) that windows was installed, I also selected the "make solution as same directory of project file".我在安装了 windows 的同一分区(C)中制作了项目,我还选择了“将解决方案制作为项目文件的同一目录”。 It was working for all semester until now, I don't know what triggered it.到现在为止,它整个学期都在工作,我不知道是什么触发了它。 Thank you all for helping me brain storm谢谢大家帮助我进行头脑风暴

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM