SFML community forums
Bindings - other languages => C => Topic started by: zys5945 on March 11, 2015, 09:18:30 pm
-
Hi I was having some trouble with using csfml, my comman to build is:
g++.exe -Wall -g -Wall -Iinclude -IC:\CSFML-2.2\include -c C:\test\src\test.cpp -o obj\Debug\src\test.o
and then the error messages pop up:
C:\test\src\test.cpp:2:17: error: 'sf' is not a namespace-name
using namespace sf;
^
C:\test\src\test.cpp:2:19: error: expected namespace-name before ';' token
using namespace sf;
^
C:\test\src\test.cpp: In function 'int main()':
C:\test\src\test.cpp:6:5: error: 'sf' has not been declared
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
^
C:\test\src\test.cpp:7:5: error: 'sf' has not been declared
sf::CircleShape shape(100.f);
^
C:\test\src\test.cpp:8:5: error: 'shape' was not declared in this scope
shape.setFillColor(sf::Color::Green);
^
C:\test\src\test.cpp:8:24: error: 'sf' has not been declared
shape.setFillColor(sf::Color::Green);
^
C:\test\src\test.cpp:10:12: error: 'window' was not declared in this scope
while (window.isOpen())
^
C:\test\src\test.cpp:12:9: error: 'sf' has not been declared
sf::Event event;
^
C:\test\src\test.cpp:13:33: error: 'event' was not declared in this scope
while (window.pollEvent(event))
^
C:\test\src\test.cpp:15:31: error: 'sf' has not been declared
if (event.type == sf::Event::Closed)
any idea?
-
btw I simply copied and pasted the tutorial code from the tutorial page, pretty sure the scope is for c++ but how do I make it compatible with c?
-
Indeed... the C++ example is not going to work in C. The API of CSFML is exactly the same as the C++ one, just in the C style. You should be able to figure out by yourself how to translate the examples, if you know how to program in C.
-
ty for the reply, but how do I translate?
-
Oh nvm I got it, thx