Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CSFML + MinGW + Batch  (Read 4055 times)

0 Members and 1 Guest are viewing this topic.

sylvainmahe

  • Newbie
  • *
  • Posts: 2
    • View Profile
CSFML + MinGW + Batch
« on: September 09, 2012, 06:04:35 pm »
Hi :)

Sorry for my bad english. For my other projects (sdl, flash as3, etc...), I used Notepad++ and batch script to compile, but this don't work with csfml :(

I have windows xp, so I downloaded Windows - MinGW (14.9 MB):
http://downloads.sourceforge.net/sfml/SFML-1.6-c-dev-windows-mingw.zip

I put .dll with .exe, .a in C:\Program Files\MinGW\lib, and .h (SFML directory) in C:\Program Files\MinGW\include (like SDL).

Ok, look my .bat :)
"C:\Program Files\MinGW\bin\g++.exe" Main.c -lcsfml-graphics -lcsfml-window -lcsfml-system -o program.exe

And my Main.c ;)
#include <stdio.h>
#include <stdlib.h>
#include <SFML/Graphics.h>
#include <SFML/Window.h>
#include <SFML/System.h>

#define SFML_DYNAMIC

int main (int argc, char *argv[])
{
        sfRenderWindow* screen;
        sfVideoMode modeScreen = {1024, 512, 32};
        sfWindowSettings settingsScreen = {24, 8, 0};
       
        //screen = sfRenderWindow_Create (modeScreen, "Video Editor", sfClose, settingsScreen);
       
        //sfRenderWindow_Close (screen);
        //sfRenderWindow_Destroy (screen);
       
        return 0;
}
 

If I unmasks screen = sfRenderWindow_Create etc.., console show me an error:
C:\DOCUME~1\user\LOCALS~1\Temp/cc21baaa.o(.text+0x8d):Main.c: undefined referenc
e to `sfRenderWindow_Create(sfVideoMode, char const*, unsigned long, sfWindowSet
tings)'

I don't understand this, I tried many tips, don't worked :-\

Can you help me please? :D

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: CSFML + MinGW + Batch
« Reply #1 on: September 09, 2012, 06:20:18 pm »
Is there a reason why you want to use the C version of SFML?
That version was actually more created as a bridge between other languages/ports and SFML itself. I highly recommend to program in C++. ;)
Also if you want to use the C version, why would you build with g++? The g++ binary is actually for compiling C++ code. If you want to compile C code then use gcc.

Also SFML 1.6 is quite outdated (over 2 years old) and has some nasty bugs and lacks quite a few features, so I advise you to use SFML 2. ;)

I'm not that familiar with MinGW/gcc nor CSFML, but I can briefly say what the error means.
g++ can't find the function sfRenderWindow_Create with the given decleration.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sylvainmahe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: CSFML + MinGW + Batch
« Reply #2 on: September 09, 2012, 06:47:26 pm »
Ok thanks :)

g++.exe work fine with c sdl project, but gcc.exe return error (sdl or csfml project).

 

anything