Is Visual Studio Compatible with ANSI C Standards?

Click For Summary

Discussion Overview

The discussion revolves around the compatibility of Visual Studio with ANSI C standards, particularly in the context of compiling simple C programs. Participants share experiences related to compile errors encountered in Visual Studio and explore potential causes and solutions.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant reports encountering multiple compile errors when attempting to run a simple C program in Visual Studio, questioning whether Visual C++ conforms to ANSI standards.
  • Another participant asks for clarification on whether the correct compiler is being used, suggesting the possibility of confusion between C++ and C# compilers.
  • A later reply indicates that the initial compile errors resolved unexpectedly after creating a new project, leading to speculation about a potential bug in Visual Studio.
  • One participant suggests modifying the main function signature to include parameters, indicating that Visual Studio may have specific requirements for empty projects.
  • Another participant emphasizes the importance of selecting the correct project type and settings when creating a new project in Visual Studio.
  • A participant shares that the issue was due to using non-standard quotation marks from a text source, which the compiler did not accept.
  • Another participant recommends using Pelles C IDE for compiling C code, describing it as lightweight and user-friendly.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the compatibility of Visual Studio with ANSI C standards, as experiences and suggestions vary. Some participants express uncertainty about the cause of the initial errors, while others provide potential solutions or alternatives.

Contextual Notes

Limitations include the possibility of misconfigured project settings in Visual Studio, the impact of using non-standard characters in code, and the lack of clarity regarding the specific compiler being utilized.

vociferous
Messages
251
Reaction score
6
I am starting a programing class for scientists and engineers at the end of the month. I wanted to brush up on my C. I used to compile C programs with Visual Studio, but now that no longer seems to work. Even simple example programs in the book generate a litiney of compile errors in Visual Studio (using the Win32 console type application)

For example:

#include <stdio.h>
int main()
{
printf("Goodbye, cruel world!\n");
return(0);
}
generates the following compile errors:

Error 1 error C2065: '"Goodbye' : undeclared identifier c:\documents and settings\administrator.minerva.000\my documents\visual studio 2005\projects\goodby world\goodby world\goodby world.cpp 11
Error 2 error C2065: 'cruel' : undeclared identifier c:\documents and settings\administrator.minerva.000\my documents\visual studio 2005\projects\goodby world\goodby world\goodby world.cpp 11
Error 3 error C2146: syntax error : missing ')' before identifier 'world' c:\documents and settings\administrator.minerva.000\my documents\visual studio 2005\projects\goodby world\goodby world\goodby world.cpp 11
Error 4 error C2017: illegal escape sequence c:\documents and settings\administrator.minerva.000\my documents\visual studio 2005\projects\goodby world\goodby world\goodby world.cpp 11
Error 5 error C2059: syntax error : ')' c:\documents and settings\administrator.minerva.000\my documents\visual studio 2005\projects\goodby world\goodby world\goodby world.cpp 11


Now, I thought that C was supposed to be an ANSI standard and that all C++ compilers were supposed to be able to handle it. Does Visual C++ not conform to that standard or am I just doing something wrong?
 
Technology news on Phys.org
Can you post the entire output of the compiler? Are you sure you're running, say, the C++ compiler, and not the C# compiler?

- Warren
 
I was using visual c++ as a console application and it was generating those errors a couple of days ago. I tried the code on several different projects (regular win32 and win32 consoles) and it refused to compile. When I tried making a new project just a few minutes ago, it compiled and ran perfectly fine. Then I reopened the project that did not compile and it compiled without errors or warnings as well. As far as I know, I did not do anything different, but apparently it is working now. Maybe it was a bug in visual studio, and rebooting fixed it.

Anyway, thanks for your help; I wish I knew what caused the error, but as long as it works now it is of no great concern.
 
TRY adding "int main(int argc, char*argv[])",i believe that's required for empty project. visual studios is kinda picky about certain things...Also make sure you ran a "Win32 console Empty project". If yiour using your own computer try making a shorter directory paths...eg. "C\Code\Projects"
 
Last edited:
After selecting new project, Win32 console, and entering the name, click on application settings, and then click on "empty project".
 
I figured out what the problem was, and it made me feel somewhat stupid. I tried posting examples from a text I was using, and I just cut-and-paste the text into the editor. The compiler did not like the fancy publishing quotation marks.
 
hahahhahahhaha
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 25 ·
Replies
25
Views
15K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 1 ·
Replies
1
Views
10K