0

I use codeblocks under the windows, there was a problem when i run the exe file built. Through codeblocks runs without errors. A separately does not work. Just I use sdl + opengl, but the problem is obvious not in them . Initially, required libstdc, has added to link to the linker options

-static-libgcc -static-libstdc++

Then another pthread, and so on. On the Internet I found a way to add to linker options is

-static -lpthread -lole32 -limm32 -lgdi32 -lwinmm -loleaut32

Next, the compiler began issuing

    /Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:566: undefined reference to `GetFileVersionInfoSizeA@8'
/Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:570: undefined reference to `GetFileVersionInfoA@16'
/Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:571: undefined reference to `VerQueryValueA@16'
/Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:566: undefined reference to `GetFileVersionInfoSizeA@8'
/Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:570: undefined reference to `GetFileVersionInfoA@16'
/Users/slouken/release/SDL/SDL2-2.0.4-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c:571: undefined reference to `VerQueryValueA@16'
collect2.exe: error: ld returned 1 exit status

I found these functions, they require winver.h. Included, but errors staying. I thought I could fix it linking mincore lib ( implementation Winver.h is here ) , but it does not see mingw

ld.exe||cannot find -lmincore|
||error: ld returned 1 exit status|

All that I have included in the project

#include<iostream>
#include<cstring>
#include<windows.h>
#include<objbase.h>
#include<winver.h>
#include<oleauto.h>
#include"SDL.h"
#include"SDL_main.h"
#include"SDL_opengl.h"
#include"SDL_image.h"
#include"GL/gl.h"
#include"GL/glu.h"
elch10
  • 35
  • 1
  • 6
  • My problem is not that I can not import the library . The problem I have is that the compiler does not see these functions, why he fails. How to import library I know. And to start the exe required libraries are already included . But the error staying, because compiler example does not see these functions(GetFileVersionInfoSizeA, GetFileVersionInfoA, etc) – elch10 Jun 24 '16 at 12:21
  • The *compiler* **does** see the functio (delcarations). It's the linker that's causing you problems. You need to link in `user32` and `kernel32` for those functions. – datenwolf Jun 24 '16 at 12:44
  • First, the addition of kernel32 and user32 has not helped. Secondly when the compiler does not find the implement of the functions he wrote at the beginning of _imp__. For example _imp__Coinitialize. This proves the fact that my question is not connected with the import library. And it is connected with the fact that why the compiler thinks that I have not unicode and therefore in the end added to A, and windows.h think that I have unicode , and therefore determines its end with W , and the compiler at the time requested function to the end A – elch10 Jun 24 '16 at 13:35
  • Here is the definition GetFileVersionInfo #define GetFileVersionInfo __MINGW_NAME_AW (GetFileVersionInfo) and the definition of __MINGW_NAME_AW here #if defined (UNICODE) # Define __MINGW_NAME_AW (func) func ## W #else # Define __MINGW_NAME_AW (func) func ## A #endif – elch10 Jun 24 '16 at 13:38
  • You can not create a subject, the problem is solved – elch10 Jun 24 '16 at 14:12

0 Answers0