Building sox from source on Windows - c

I'm trying to build sox from source using Visual Studio 2013 on Windows 8.
I can build the other dependencies but when I try to compile libsndfile I get the following errors:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(506): error C2059: syntax error : '(' [C:\Users\colinp\Documents\Visual Studio 2013\Projects\sox\sox-14.4.2\sox-14.4.2\msvc10\LibSndFile.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(584): error C2059: syntax error : '(' [C:\Users\colinp\Documents\Visual Studio 2013\Projects\sox\sox-14.4.2\sox-14.4.2\msvc10\LibSndFile.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(506): error C2059: syntax error : '(' [C:\Users\colinp\Documents\Visual Studio 2013\Projects\sox\sox-14.4.2\sox-14.4.2\msvc10\LibSndFile.vcxproj]
What am I doing wrong?
EDIT: The relevant line in math.h:
_CRTIMP long __cdecl lrint(_In_ double _X);
EDIT: This is one example of #include <math.h>:
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
content of sfconfig.h: https://github.com/erikd/libsndfile/blob/master/src/sfconfig.h
Looking at the libsndfile website and README, it recommends using GCC to compile, so I'm going to try that instead.

Related

getting cstdio errors despite it not being included? (Visual Studio)

I'm trying to compile a C program in Visual Studio 2019, I have 'Compile As' set to 'Compile as C Code (/TC)' and cstdio is not included anywhere in my project, yet it still gives me cstdio errors
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\cstdio(33,1): error C2061: syntax error: identifier 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\cstdio(33,1): error C2059: syntax error: ';'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\cstdio(33,1): error C2449: found '{' at file scope (missing function header?)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\cstdio(91,1): error C2059: syntax error: '}'

How to solve fatal error c1083 in Visual Studio 2019?

I am following this walkthrough to compile my C program in Visual Studio 2019:
https://learn.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=vs-2019
My program contains the lines "#include R.h" and "#include math.h".
Unfortunately, Visual Studio yields the following error:
fatal error C1083: Cannot open include file: 'R.h': No such file or directory
I found many solutions to this problem on the internet, but none of them appears to work.
Could you help me out?

error C2375: 'printf' : redefinition; different linkage c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h

I have a solution which is originally compiled for VS2015. I'm trying to compile the same code in VS2012. To do this, I've created a new solution, added these projects to the new solution and changed the project properties Platform Toolset to v110 instead of v140.
While building this solution, I am facing the error:
error C2375: 'printf' : redefinition; different linkage c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h 271
The line which seems to be causing this error is:
_Check_return_opt_ _CRTIMP int __cdecl printf(_In_z_ _Printf_format_string_ const char * _Format, ...);
I'm unable to figure out the root cause of this problem. Any help would be appreciated.

Bunch of compilation errors in cmath when building C code in Visual Studio 2010

I'm trying to compile C code in VS2010. When I do, I get 714 errors in cmath, a file I haven't even included.
Here are the included files: http://pastebin.com/LzsDfEcr
The errors are all the same "style", e.g:
Error 711 error C2061: syntax error : identifier 'ceil' c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath 40
Error 712 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath 40
and then the same two errors just with another identifier.
I have Compile As C on under C/C++ -> Advanced, and all the files in the project are .c files.
<cmath> is a C++ header file. It's probably being included by some other C++ header file. Looking at your code, I can see that you're including <string> and <sstream>, both of which are C++ header files.
//#include <unistd.h> // doesn't exist in vs2010?
unistd.h is a unix header

Errors in building C project in visual studio 2010

I have project lets say PROJECT in C. It contains a number of header files and source files. I build the project in following way
File->New->project from external files
I gave the location of the project files and Name of the project.
Choose the option as Console
and then finish
The project is seen in the solution bar with
external dependencies, header and source file.
When I build it i get error in header file such as
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(15): error C2054: expected '(' to follow '__extension__'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stddef.h(73): error C2085: '__threadid' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stddef.h(75): error C2085: '__threadhandle' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(37): error C2085: '_flock_t' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(40): error C2085: '_iconv_t' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(15): error C2082: redefinition of formal parameter '_environ'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(17): error C2082: redefinition of formal parameter '_exit'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(19): error C2085: 'access' : not in formal parameter list
What can be the reason for it?
The __extension__ keyword is used by gcc to indicate that you know that something is an extension but want to use it anyway, and request the compiler not to warn about that.
http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
Seems like you include some header that is gcc specific and doesn't work for MSVC.

Resources