SFML community forums
Help => General => Topic started by: jp on January 17, 2016, 02:55:47 pm
-
****** UPDATE: please note this problem seems to be due to VC++ problem which seems to be "broken" somehow on my machine currently, so this post can be ignored until I fix it ***********
SOLVED (VS SETTINGS ISSUE): IF YOU WANT TO KNOW THE REASON, ITS IN THE LAST POST.
********************************************************************************
Hello,
I followed the instructions from the SFML documentation to install SFML to my Visual Studio 2015 community but I keep getting these errors:
1>------ Build started: Project: SfmlConcoleTemp, Configuration: Debug x64 ------
1> main.cpp
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\config.hpp(163): error C2061: syntax error: identifier 'sf'
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\config.hpp(163): error C2059: syntax error: ';'
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\config.hpp(164): error C2449: found '{' at file scope (missing function header?)
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\config.hpp(190): error C2059: syntax error: '}'
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\system\clock.hpp(35): error C2061: syntax error: identifier 'sf'
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\system\clock.hpp(35): error C2059: syntax error: ';'
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\system\clock.hpp(36): error C2449: found '{' at file scope (missing function header?)
1>e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\system\clock.hpp(84): error C2059: syntax error: '}'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\vcruntime.h(294): error C2146: syntax error: missing ')' before identifier '_StackCookie'
...
I put my SMFL folder to: H:\SFML and then I also tried to put it on the same project where the project is but it does not help.
The project recognizes #include <SFML\Graphics.hpp> ... it does not give any red marks when I put it in main.cpp so the project can see SFML\Graphics.hpp.
I have done it in couple of ways (I also followed the youtube instructions at watch?v=2JVpmWwMo0o ) but I get the same error. Is there some setting in VS2015 default project which are not compatible with SFML? I tried Windows version and console version but I get the same errors.
I downloaded SFML-2.3.2-windows-vc14-64-bit and have Windows 10 compiled with 64bit projects.
Does the binary SFML-2.3.2-windows-vc14-64-bit work out of the box or I have to compile it somehow?
Thank you.
-
GCC is a compiler on its own, if you use Visual Studio use the Visual Studio package.
If you're even getting compiler errors in VS headers, your VS install is broken or you did something very odd.
-
Sorry I pasted the wrong file name... I did not use GCC version but VS version. I really used: SFML-2.3.2-windows-vc14-64-bit. I just compiled again using this one and it gives the same error messages.
But the first error messages are coming from SFML, so why are they coming?
The VC errors can be because of the SFML error messages, isnt it?
The first error message is: "error C2061: syntax error: identifier 'sf'", so it cannot find the sf namespace for same reason. I guess it has nothing to do with VS header files.
-
What does your e:\important\programming\c++\temp\sfmlconcoletemp\sfmlconcoletemp\include\sfml\config.hpp contain?
-
hmm, I found something strange... my 64 bit project does not understand "namespace" keyword :) (32 bit understands). So this might be the issue. I will try to solve this and come back after that if there is any SFML related issues. This is why it was complaining about "namespace sf".
Yes, its possible my VS got somehow broken today. It worked ok yesterday so it surpriced me...
-
I can't imagine that the compiler doesn't understand namespace. There's probably something messed up in header files, like an unmatched parenthesis. Maybe combined with conditional compilation, so it manifests only in x64 mode.
In case of doubt, reinstall VS.
-
Don't know, but this never happened before. Am sure all (including namespaces) were compiling ok yesterday. But yes, just uninstalling and re-installing VS now.
But the odd thing is that if I start a totally new x64 project it does not understand "namespace". But lets see what happens after I re-installed.
-
uh, I found the problem!! :). Just for the record, it was this: In properties Advanced/Compile As , I has "compile as C" , :). I was testing something in the morning and I guess was copied to all projects somehow (still dont know why all other projects had it also? even though I started new projects). So that should be "compile as C++". Its strange that even after re-installing it was still there , C compilation. Maybe it stayed in the registry.
If a moderator can delete this post, maybe best to delete as it was not a SFML issue. or move it.
-
Settings usually are kept unless you explicitly removed them.
We don't delete threads, maybe someone will run into a similar issue one day...