News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

undefined reference to `Direct3DCreate8@4

Started by jokerar, August 01, 2005, 04:12:58 AM

Previous topic - Next topic

jokerar

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

rickg22

That error usually means a required library wasn't linked. Did you include the appropriate library in the project's used libraries?

jokerar

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

darklordsatan

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.

jokerar

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.

jokerar

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.

jokerar

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.

darklordsatan

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?

rickg22

I think you need to add the libraries in the *project* settings rather than the global settings. The project settings override the global settings.

Ceniza

Quote from: jokerarBut 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.

jokerar

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.

zieQ

#11
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.

rickg22

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! :( )

tiwag

Quote from: rickg22 on August 04, 2005, 05:41:53 PM
... Specially when Yiannis took a 3-week vacation! :( )

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

rickg22

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 :)