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

  • Home
  • SEARCH
  • 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 8585519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:05:09+00:00 2026-06-11T22:05:09+00:00

I am using Visual Studio 2010 Express and I am getting the following errors

  • 0

I am using Visual Studio 2010 Express and I am getting the following errors for the file test.h, which when compiled outputs:

test.h(4): error C2061: syntax error : identifier 'test'
test.h(4): error C2059: syntax error : ';'
test.h(4): error C2449: found '{' at file scope (missing function header?)
test.h(18): error C2059: syntax error : '}'

The file test.h is described as follows:

#ifndef TEST_H
#define TEST_H

class test {
    int a; 
    int b; 
public:        
    test(int a, int b) { 
        this->a = a;
        this->b = b;
    }

    int add() { 
        return 0;
    }
};

#endif

The other file in the VS2010 project is test.c which is:

#include "test.h"

int main(int argc, char** argv) {
    return 0;
}

I have a tried of multitude of ways to resolve this problem. Even if I define test.h as follows:

class test{

};

I still receive the same set of errors.

I saw a similar problem
https://stackoverflow.com/questions/7798876/strange-errors-when-using-byte-pbyte-instead-of-char-char-in-vs2k10-wdk-envi
with no response.

I will be really grateful if someone could please point out how to resolve these errors.

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-06-11T22:05:10+00:00Added an answer on June 11, 2026 at 10:05 pm

    The Microsoft compiler supports both C and C++ languages, but they are not the same and need to be treated differently (for example class is no keyword in C and thus ultimately causes the error your get). So it has to somehow “know” what kind of language (C or C++) it is dealing with when compiling a source file (and thus also processing the includes).

    It thinks you are trying to compile a C language file (because it has the file extension .c), while you are actually using the C++ language. Rename your file to have one of the file extensions the Microsoft C/C++ compiler recognizes as C++: .cpp, .cxx or .cc.

    Alternatively, if you cannot rename the file, you can also use the /Tp command line option of cl.exe to force it to treat the file as a C++ file (for completeness /Tc would force the C language).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual C# Studio 2010 Express and I have oakward problem. I
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; What I'm ultimately trying to do is update a sql
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; Kinda new at C# here.. I got the first row
I am using IIS Express in Visual Studio 2010 and right now it runs
I am wondering if I can use VB.NET(I am using visual studio 2010 express)
I am using visual studio 2010 express C#. When ever i try to create
I'm using Visual Studio C++ 2010 Express. I made this function with variable argument
I'm using Microsoft Visual Studio 2010 Express: the C++ and VB versions. There is
I am using Visual Studio C# 2010 Express and is learning. RESTSharp is supposed
I'm using Visual Studio Express 2010, with freeglut_static.lib linked (in Properties>Linker>Input>Additional Dependencies, version 2.8.0)

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.