Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3614466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:15:08+00:00 2026-05-18T22:15:08+00:00

I am new to Visual Studio. I’m trying to run Hello World, but am

  • 0

I am new to Visual Studio. I’m trying to run Hello World, but am getting several errors and cannot figure out what the problem is.
I typed:

#include<stdio.h>

main()
{
    printf("Hello World");


}

into a code file with .c extension. I get this:

Error   1   error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup   
d:\Users\...\MSVCRTD.lib(crtexe.obj)    Project

Error   2   error LNK1120: 1 unresolved externals   
d:\users\...Project.exe 1   1   Project

Anyone know what the problem is?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:15:08+00:00Added an answer on May 18, 2026 at 10:15 pm

    It compiles fine… you need to set it to compile as C code:

    Project->Properties->Advanced->Compile As C Code (/TC flag)

    #include<stdio.h>
    
    main()
    {
        printf("Hello World");
    
    
    }
    

    Output:

    1>------ Build started: Project: main,
    Configuration: Debug Win32 ------
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped
    ==========
    

    Reason:

    You are compiling as C code and therefore default int is not assumed in C++ code

    Update:

    As mentioned by Michael Burr your code should use a *.c extension. However, it will still compile cpp files as c code if you set the project properties. However, if no setting is provided it will compile with the default settings (*.c -> c code) and (*.cpp -> cpp code).

    Compiled as C code with CPP extension (successful)

    1>------ Build started: Project: main, Configuration: Debug Win32 ------
    1>  main.cpp
    1>  main.vcxproj -> c:\users\shane\documents\visual studio 2010\Projects\main\Debug\main.exe
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    

    Compiled as CPP code with C Extension (failed)

    1>------ Build started: Project: main, Configuration: Debug Win32 ------
    1>  main.c
    1>c:\users\shane\documents\visual studio 2010\projects\main\main\main.c(4): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to set up a new visual studio 2008 solution while
I'm completely new to Visual Studio and I'm having some trouble getting a project
I am very new to Visual Studio but i would like to use it
I'm new to visual studio, so perhaps this is something easy... but I've had
I'm fairly new to Visual Studio (specifically Visual Basic .NET) but have been programming
To reproduce the error I'm getting: Create a new Visual Studio 2010 ASP.NET web
I'm new to Visual Studio, and I'm just trying to write code as efficiently
I created a new Visual Studio Setup project with VS 2008. I use it
I've just got the new Visual Studio 2010 Ultimate and Javascript Intellisense is not
Im new to visual studio and C# - and one thing in VS drives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.