Author Topic: undefined reference to `Direct3DCreate8@4  (Read 9712 times)

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
undefined reference to `Direct3DCreate8@4
« on: August 01, 2005, 04:12:58 am »
sorry to bother you with this stupid qoestion. After i installed
rc 1, i set the Global Compiler options to point the Lib and Include directories
to directx8 sdk accordingly, but i still get this error when i compile...

is it something i didnt do? What could possibly be the cause of it?
thanks.

.objs\WinMain.o(.text+0x1ff):WinMain.cpp: undefined reference to `Direct3DCreate8@4'
Process terminated with status 1 (0 minutes, 0 seconds)


undefined reference to `Direct3DCreate8@4

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: undefined reference to `Direct3DCreate8@4
« Reply #1 on: August 01, 2005, 04:17:54 am »
That error usually means a required library wasn't linked. Did you include the appropriate library in the project's used libraries?

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: undefined reference to `Direct3DCreate8@4
« Reply #2 on: August 01, 2005, 04:25:10 am »
you mean i have to right click my project under the workspace,
select propertise, and set their lib and include directories again after
i set them in global compiler option menu? Is not it automatically done with
global option? Do i  have to do that everytime i start a new project? thanks

Offline darklordsatan

  • Almost regular
  • **
  • Posts: 132
    • http://eviltrend.sf.net
Re: undefined reference to `Direct3DCreate8@4
« Reply #3 on: August 01, 2005, 05:34:19 am »
Ok, so you put the required included dirs. However, you need to include the libraries (you know, the .lib or .a) in the "Linker Option" tab, wheter globally (in which case you wont need to do it for every project) or locally for every project.

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: undefined reference to `Direct3DCreate8@4
« Reply #4 on: August 01, 2005, 05:46:50 am »
thanks for the reply, but i believe i must make myself clearer:

the directx sdk has two directories that i pointed in global compiler options,
Include:this is the directory i pointed in 'compiler' tab of 'Directories' tab, like this

d:\SDK\dx_81\include
d:\MinWG\include

Lib:this is the linker folder i pointed in the 'linker' tab:

d:\SDK\dx_81\LIB
d:\MinWG\lib

my dx sdk folders are  placed above mingw folders

im confused.

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: undefined reference to `Direct3DCreate8@4
« Reply #5 on: August 01, 2005, 05:50:30 am »
as to the 'Linker Option' thing, there are so many lib files that
i just included 3 of them to try:
d3d8.lib
d3dx.lib
d3dx8.lib

but in vain. problem remained.

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: undefined reference to `Direct3DCreate8@4
« Reply #6 on: August 01, 2005, 06:00:23 am »
hi, its ok now, i own that i made a mistake with my code,
these are original lines:

// Include files
#include <windows.h>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"

i changed the last two to:
#include <d3d8.h>
#include <d3dx8.h>

and it compiles. But is it possible to make codeblock search for default include directories
'after' it searched the working directories if the files could not be found there? thanks.

Offline darklordsatan

  • Almost regular
  • **
  • Posts: 132
    • http://eviltrend.sf.net
Re: undefined reference to `Direct3DCreate8@4
« Reply #7 on: August 01, 2005, 07:02:35 am »
I dont quite understand what you mean.
If you look at the Directories->Compiler tabs (in compiler options), where you put the include dirs, you see there are some arrows (I forgot the real name of that widget  :D). The compiler will try to look for headers (or libs, if in the Directories->Linker tabs) in the given order, so you can use the aforementioned arrows to change the precedence of such dirs (which one will be looked for first, second, and so on).
In the case of having two dirs, one in the global compiler setting an another in the local project compiler settings, my bet is that it searches for the local settings first and then tries to look at the global settings.
Is this what you're asking?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: undefined reference to `Direct3DCreate8@4
« Reply #8 on: August 01, 2005, 07:11:21 am »
I think you need to add the libraries in the *project* settings rather than the global settings. The project settings override the global settings.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: undefined reference to `Direct3DCreate8@4
« Reply #9 on: August 01, 2005, 07:15:28 am »
Quote from: jokerar
But is it possible to make codeblock search for default include directories 'after' it searched the working directories if the files could not be found there?

If I get your question right the answer would be: it's the compiler's job.

All Code::Blocks would do is to add a few -I when calling the compiler (to tell the compiler there're extra include directories) but, after that, it's all in the compiler's "hands".

Just try to keep the convention in mind: #include <header> for headers in global directories (the ones added with -I count there) and #include "header" for headers in the current directory.

Offline jokerar

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: undefined reference to `Direct3DCreate8@4
« Reply #10 on: August 04, 2005, 05:31:22 am »
yes Ceniza, u understood my question perfectly.
so my best bet is to stick to the convention it seems.
i hope codeblock would search all directories regardless of
compiler convention, and display a warning.
that will make my life easier.

thank you.

Offline zieQ

  • Almost regular
  • **
  • Posts: 155
Re: undefined reference to `Direct3DCreate8@4
« Reply #11 on: August 04, 2005, 12:48:35 pm »
Searching the include directories regardless of the syntax of the include in NON-STANDARD. Imagine I have 2 files with the same name in 2 directories (bad idea however) the syntax allow making a difference between the local one and the global one. That allow to create a class List in a file "list" without any conflict with those of the STL. So it will not change, otherwise it may introduce bugs due to non-standard behaviour.
« Last Edit: August 04, 2005, 12:51:58 pm by zieQ »

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: undefined reference to `Direct3DCreate8@4
« Reply #12 on: August 04, 2005, 05:41:53 pm »
I added a feature request to check for invalid libraries (and possibly search them) at the moment you add them. Anyone's invited to work on it. (I can't fix all bugs by myself! Specially when Yiannis took a 3-week vacation! :( )

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: undefined reference to `Direct3DCreate8@4
« Reply #13 on: August 04, 2005, 05:49:17 pm »
... Specially when Yiannis took a 3-week vacation! :( )

hehe... 3 weeks of horror for Rick  :shock:

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: undefined reference to `Direct3DCreate8@4
« Reply #14 on: August 04, 2005, 08:54:53 pm »
Tiwag, if you help me fix the lot of SDK bugs reported, I'll promote you to developer! :D

(Um, that doesn't sound very appealing, does it? :(  but hey, CVS access :)