Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling error in C++ project with C and C++ codes

I've created a C++ project where I use C and C++ codes and have some problems with headers... OK, I have 3 codes:

basicOCR.cpp

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "preprocessing.h"
#include "basicOCR.h"

preprocessing.c

#include <stdio.h>
#include <ctype.h>
#include <math.h>

#include "preprocessing.h"

main.c

#include <stdio.h>
#include <ctype.h>

#include "basicOCR.h"

and my 2 own header files:

basicOCR.h

#include <stdio.h>
#include <ctype.h>

preprocessing.h

#include <stdio.h>
#include <ctype.h>

Whenever I try to compile a project, it compiles basicOCR.cpp without any problems but preprocessing.c and main.c give me syntax errors in cstdlib and xstddef. I know that they are C++ libraries. I read this How to mix C and C++

and tried almost everything but it didn't work.

1>  preprocessing.c
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'abs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'atexit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atof'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atoi'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'calloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'div'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'exit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'free'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'getenv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'labs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'ldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'malloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mblen'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbstowcs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbtowc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'qsort'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'rand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'realloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'srand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtod'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'strtoul'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'system'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wcstombs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wctomb'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(32): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'lldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2061: syntax error : identifier 'tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2449: found '{' at file scope (missing function header?)
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(101): error C2059: syntax error : '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2143: syntax error : missing '{' before ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2059: syntax error : ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\eh.h(27): fatal error C1189: #error :  "eh.h is only for C++!"
1>  main.c
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(19): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'abs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2061: syntax error : identifier 'atexit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(21): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atof'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atoi'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2061: syntax error : identifier 'atol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(22): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'calloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2061: syntax error : identifier 'div'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(23): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'exit'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'free'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2061: syntax error : identifier 'getenv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(24): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'labs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'ldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2061: syntax error : identifier 'malloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(25): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mblen'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbstowcs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2061: syntax error : identifier 'mbtowc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(26): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'qsort'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'rand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2061: syntax error : identifier 'realloc'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(27): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'srand'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtod'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2061: syntax error : identifier 'strtol'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'strtoul'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2061: syntax error : identifier 'system'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wcstombs'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2061: syntax error : identifier 'wctomb'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(32): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2061: syntax error : identifier 'lldiv'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(34): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2054: expected '(' to follow 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstddef(18): error C2061: syntax error : identifier 'using'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(78): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(87): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2061: syntax error : identifier 'tr1'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(98): error C2449: found '{' at file scope (missing function header?)
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(101): error C2059: syntax error : '}'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2143: syntax error : missing '{' before ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(125): error C2059: syntax error : ':'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(132): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2143: syntax error : missing '{' before '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstddef(141): error C2059: syntax error : '<'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\eh.h(27): fatal error C1189: #error :  "eh.h is only for C++!"
like image 202
OpenMinded Avatar asked Mar 01 '12 10:03

OpenMinded


People also ask

What are the errors in C programming language?

These errors are applicable to almost all the programming languages but we’ve explained here using C programming language. There are some specific types of errors in programming that you must know. 1. Improper Comment Characters There are two methods of commenting allowed in C programming.

What are compile time errors in C++?

This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by compiler and thus are known as compile-time errors. Syntax of a basic construct is written wrong.

What is syntax error in C++ compiler?

Type of errors Syntax errors: Errors that occur when you violate the rules of writing C/C++ syntax are known as syntax errors. This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by compiler and thus are known as compile-time errors.

How to compile C code into C++ in Visual Studio?

The solution to this was to make a right click on each C code and Properties>C/C++>Advanced>Compile As and check Compile as C++ Code (/TP) A better solution would be to use the .cpp file extension - and then visual studio will automatically compile it using the C++ compiler.


1 Answers

I got that. The solution to this was to make a right click on each C code and Properties>C/C++>Advanced>Compile As and check Compile as C++ Code(/TP)

like image 57
OpenMinded Avatar answered Oct 21 '22 09:10

OpenMinded