How do I get MinGW to accept DirectX 11? - c++

After attempting the solutions here and here, I got Eclipse to the point where it doesn't give me a bunch of errors while I'm writing my DX11 application. The linker on the other hand, continues to give me some undefined reference errors. Right now, it's just for IID_IDXGIFactory and CreateDXGIFactory simply because I haven't finished the Initialize() function and there's no other part of the code that uses the DirectX API.
What am I missing that is causing these errors in the linker?
Edit: Libraries included are the x64 versions of dxgi, dxguid, d3d10, d3dx10, d3d11 and d3dx11 in that order. I already know that not linking to the correct libraries causes undefined reference errors. My question is, what am I missing?

Related

Getting a lot of "undefined reference to" errors at linking stage from library that is not even used in the project

I am getting a lot of undefined reference to errors at linking stage, looking similar to this:
libQt5Sql.so.5: undefined reference to `QAbstractTableModel::~QAbstractTableModel()#Qt_5'
The problem is that I am not even using Qt in my project. The only possible connection to Qt is that I am using Vtk and PCL, which were linked to Qt during their compilation. And adding paths to libQt5Sql, libQt5Core etc doesn't help, more and new undefined reference to errors appear. The same code with the same settings works on another PC. What can be the problem here?
I've spent 2 days trying to solve this, and found the solution right after posted the question here. The thing I needed to do is to add the path to Qt libs:
export LD_LIBRARY_PATH=/home/vaheta/Qt5.6.3/5.6.3/gcc_64/lib:$LD_LIBRARY_PATH

Cannot use LibHaru because cannot find the reference of zlib

I am trying to build a program that will hopefully create dynamic .pdf files. I have actually developed a similar project with PHP for web, but now I want to write it with C++.
This resulted me to rebuild those three libraries (zlib, libpng and libharu) more than time times for the last four days. I have read all the relevant entries in the web (including this stack overflow entry) I understood that my problem is that the compiler cannot find zlib (maybe I understood the problem wrongly)
I want to explain what I've done. Please note that I'm using Codeblocks IDE with GNU GCC C++ Compiler (MingGW) in Windows 7. First, I compiled zlib 1.2.7 and created my zlib.a static library file (I'm using static libraries). Secondly, I compiled libpng 1.5.13 and created my libpng.a. Thirdly, I compiled libharu (snapshot) and created my libharu.a static library file. Then I added those library files to my project. (I did everything explained in here). And at last, compiled my project.
Well, I shall say I did those all steps more than ten times, changing some small things, but everytime I am getting an error. I have even tried the official examples in libharu.org.
The most weird thing is that my error is NOT stable. Nearly everytime I got different errors! But mostly it was related with hpdf_streams.c.
My recent log file:
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xd4a): undefined reference to `deflateInit_'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xdfa): undefined reference to `deflate'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xe78): undefined reference to `deflateEnd'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xee2): undefined reference to `deflate'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xf7e): undefined reference to `deflateEnd'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xfb7): undefined reference to `deflateEnd'
C:\Libs\libharu-201301131604\libharu.a(hpdf_streams.o):hpdf_streams.c:(.text+0xff1): undefined reference to `deflateEnd'
We just had this issue. You need to recompile zlib with WIN_API off. Or use the dll's and not the static library.

Lots of undefined references to wxWidgets classes

When I compile my wxWidgets project, I get lots of errors stating things similar to:
undefined reference to _imp___ZN16wxEventHashTableD1EV
There are more than 50 of these, and it just started happening when I tried to statically link wxwidgets to the exe. I am using wxPack under windows. These errors did not show up when I was dynamically linking wxWidgets. Does anyone know what's going on here?
The imp* prefix means you are still pointing the linker to import libraries that go with the dynamic wxWidgets build. (.dll files located in lib/gcc_dll/*)
Make sure you built wxWidgets statically as well and then point the linker to the right location. The correct files should be under: lib/gcc_lib/*

undefined reference to glCompressedTexImage2D

I am trying to load some .dds textures for my game.
My IDE is Dev-C++ with GLUT 7.6 installed.
When I use OpenGL functions like glTexImage2D() or glVertex2f() my programs compile normally but when I try any of the glCompressedTexImage functions the linker tells me that there's an undefined reference to it.
like that: [Linker error] undefined reference to `glCompressedTexImage2D#32'.
I am linking my project only with libopengl32.a, and I am using Win API for the window.
Does I need to add another library in the linker options or my OpenGL version is too old ?
On windows platform opengl32.lib provides functions only for a very old GL version (1.1 or something like that). If you want functionality from newer OpenGL version, then you should get pointers to missing functions using wglGetProcAddress.
However, this is too much hassle. So instead of that you can use OpenGL extension library (GLEW or GLEE) to get missing function addresses for you. It is a better idea to use GLEW instead of GLEE, since GLEE looks abandoned.

Build errors w/ GLee (GL Easy Extension Library)

Using Code::Blocks w/ mingw, and trying to use GLee for some OpenGL on windows. I'm getting the following build errors:
GLee.c|60|undefined reference to `_wglGetProcAddress#4'
GLee.c|10748|undefined reference to `_wglGetProcAddress#4'
GLee.c|10751|undefined reference to `_wglGetCurrentDC#0'
GLee.c|10797|undefined reference to `_glGetString#4'
GLee.c|10910|undefined reference to `_glGetString#4'
GLee.c|10976|undefined reference to `_glGetString#4'
And I'm just including GLee likes so (with GLee.c, not the .dll):
#include "GLee.h"
According to Ben Woodhouse, GLee is "written in pure ANSI C, so any C or C++ compiler should work. You can include the source files in your projects directly or compile them into a library", so I should be having no problems.
Google didn't give me much on this, so I'm hoping some OpenGL vets (or anyone familiar with GLee) out there can point me in the right direction.
It looks like you need to link your application against the OpenGL libraries (specifically Opengl32.lib) which will provide the functions that you are missing. Perhaps the OpenGL FAQ might be of help in figuring this out.