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

Author Topic: Noob link error, binding issue?  (Read 4892 times)

0 Members and 1 Guest are viewing this topic.

nat8

  • Newbie
  • *
  • Posts: 2
    • View Profile
Noob link error, binding issue?
« on: December 05, 2016, 02:46:35 pm »
Hi,
I can get a test program running on Win 10 using SFML 2.4.1 (GCC 4.9.2 TDM (SJLJ) - 32-bit), but am having trouble doing the same with CSFML 2.3 (using the same compiler, using the CSFML files as supplied). I'm very rusty so expect it to be a noob error, please be gentle ;)

I can get to the same point in codeblocks and commandline. What I am doing and the output is this:
Code: [Select]
gcc -ICSFML/include -LCSFML/lib/gcc -LSFML-2.4.1/lib ctest/main.c -octest/main.exe
C:\Users\GAMING~1\AppData\Local\Temp\ccWpC4tj.o:main.c:(.text+0x56): undefined reference to `_imp__sfWindow_create'
C:\Users\GAMING~1\AppData\Local\Temp\ccWpC4tj.o:main.c:(.text+0x69): undefined reference to `_imp__sfWindow_isOpen'
collect2.exe: error: ld returned 1 exit status

So it read the header but couldn't find the definition. But looking in libcsfml-window.a with 7zip it appears to be there (but it's looking for "underscore imp double underscore", the lib has it as "double underscore imp underscore", no idea why that would be or if it matters):
Code: [Select]
...
d000025.o    sfWindow_createFromHandle
d000025.o    __imp_sfWindow_createFromHandle
d000024.o    sfWindow_create
d000024.o    __imp_sfWindow_create
d000023.o    sfWindow_close
d000023.o    __imp_sfWindow_close
...

Here's the test code, which is just example code cut down and converted to C:
Code: [Select]
#include <SFML/Window.h>
int main()
{
    sfWindow *window;
    sfVideoMode mode = {800, 600, 32};
    window = sfWindow_create(mode, "Title", sfTitlebar|sfClose, NULL);
    while (sfWindow_isOpen(window)){}
    return 0;
}

I've googled, changed the order of the gcc parameters, tried -std=c99, did the same in codeblocks using the c++ tutorial, and am out of ideas. Any ideas where I'm going wrong?

 

anything