Compiling problem under MS Visual Studio C++ express 2010

Asked by Liang Jin Lim

Hi, I have installed the Fenics Project version 1.0 beta under windows XP. The installation has no problem.
Then I used Fenics shell to access c:/fenics/share/dolfin/demo and generate a Visual Studio 10 project file using cmake -G "Visual Studio 10" option.

I then opened up the project solution under MS Visual Studio C++ 2010 Express. The solution file has no problem lisitng out all the demo projects in Visual Studio. However when I tried to build one of the demo project, I am not able to solve it. Generated build messages are:

1>------ Build started: Project: demo_elasticity, Configuration: Debug Win32 ------
1> Building Custom Rule C:/FEniCS/share/dolfin/demo/undocumented/elasticity/cpp/CMakeLists.txt
1> CMake does not need to re-run because C:\FEniCS\share\dolfin\demo\msvc\undocumented\elasticity\cpp\CMakeFiles\generate.stamp is up-to-date.
1>cl : Command line warning D9002: ignoring unknown option '-frounding-math'
1>cl : Command line warning D9002: ignoring unknown option '-fopenmp'
1> main.cpp
1>C:\FEniCS\include\math.h(361): error C2143: syntax error : missing ')' before ':'
1>C:\FEniCS\include\math.h(361): error C2059: syntax error : ')'
1>C:\FEniCS\include\math.h(361): error C3861: '__asm__': identifier not found
//... truncated ...
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cmath(37): error C2039: 'abs' : is not a member of '`global namespace''
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cmath(37): error C2873: 'abs' : symbol cannot be used in a using-declaration
1>C:\FEniCS\include\stdio.h(335): error C2373: '__restrict__' : redefinition; different type modifiers
1> C:\FEniCS\include\stdio.h(335) : see declaration of '__restrict__'
1>C:\FEniCS\include\stdio.h(338): error C2086: 'const char *__restrict__' : redefinition
1> C:\FEniCS\include\stdio.h(337) : see declaration of '__restrict__'
1>C:\FEniCS\include\stdio.h(614): error C2373: '__restrict__' : redefinition; different type modifiers
1> C:\FEniCS\include\stdio.h(613) : see declaration of '__restrict__'
1>C:\FEniCS\include\stdio.h(616): error C2086: 'const wchar_t *__restrict__' : redefinition
1> C:\FEniCS\include\stdio.h(615) : see declaration of '__restrict__'
1>C:\FEniCS\include\stdlib.h(318): error C2144: syntax error : 'double' should be preceded by ';'
1>C:\FEniCS\include\stdlib.h(318): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\FEniCS\include\stdlib.h(319): error C2146: syntax error : missing ',' before identifier '__nptr'
1>C:\FEniCS\include\stdlib.h(321): error C2065: '__nptr' : undeclared identifier
1>C:\FEniCS\include\stdlib.h(321): error C2065: '__endptr' : undeclared identifier
1>C:\FEniCS\include\stdlib.h(323): error C2373: '__restrict__' : redefinition; different type modifiers
1> C:\FEniCS\include\stdlib.h(323) : see declaration of '__restrict__'
//... truncated ...
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cwchar(25): error C2039: 'fgetws' : is not a member of '`global namespace''
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cwchar(25): error C2873: 'fgetws' : symbol cannot be used in a using-declaration
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cwchar(26): error C2039: 'fputws' : is not a member of '`global namespace''
1>c:\Program Files\Microsoft Visual Studio 10.0\VC\include\cwchar(26): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Any help is greatly appreciated!

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johannes Ring
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

The Windows binary was compiled with the MinGW compilers and you must use the same compilers when building a demo. The included CMake binary is set to use MinGW compilers by default so it should be enough to move to the demo directory of your choice and run "cmake .".

Revision history for this message
Liang Jin Lim (limliangjin) said :
#2

Does this means that Ms Visual Studio is not supported by Fenics Project?
I was able to build them using MingW, just that I am trying to use Visual Studio as my IDE.

Revision history for this message
Best Johannes Ring (johannr) said :
#3

No, you cannot use Visual Studio with the Windows binary.

Revision history for this message
Liang Jin Lim (limliangjin) said :
#4

Thanks Johannes Ring, that solved my question.