www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Help with derelict and codeblocks

reply Jarno Tuomainen <zorbuz gmail.com> writes:
Simple question: anyone got derelict working with codeblocks ide 
(www.codeblocks.org)?

IDE supports D and works just fine, but i cant seem to get derelict 
working with it (i get plenty of undefined symbol errors when i try to 
complie sdl stuff with it).

Complier output. This is when compiling dmedia opengl tutorial:

--- cutpaste ---
::  Symbol Undefined _glMatrixMode
::  Symbol Undefined _glLoadIdentity
::  Symbol Undefined _gluPerspective
::  Symbol Undefined _D8derelict3sdl3sdl16DerelictSDL_LoadFZv
::  Symbol Undefined _D8derelict6opengl2gl15DerelictGL_LoadFZv
::  Symbol Undefined _D8derelict6opengl3glu16DerelictGLU_LoadFZv
::  Symbol Undefined _SDL_Init
::  Symbol Undefined _SDL_GL_SetAttribute
::  Symbol Undefined _SDL_SetVideoMode
::  Symbol Undefined _SDL_WM_SetCaption
::  Symbol Undefined _SDL_PollEvent
::  Symbol Undefined _glClear
::  Symbol Undefined _SDL_GL_SwapBuffers
::  Symbol Undefined _SDL_Quit
::  Symbol Undefined _D8derelict6opengl3glu18DerelictGLU_UnloadFZv
::  Symbol Undefined _D8derelict6opengl2gl17DerelictGL_UnloadFZv
::  Symbol Undefined _D8derelict3sdl3sdl18DerelictSDL_UnloadFZv
::  Symbol Undefined _glBegin
::  Symbol Undefined _glColor3f
::  Symbol Undefined _glVertex3f
::  Symbol Undefined _glEnd
---/cutpaste---
May 09 2006
parent reply Mike Parker <aldacron71 yahoo.com> writes:
Jarno Tuomainen wrote:
 Simple question: anyone got derelict working with codeblocks ide 
 (www.codeblocks.org)?
 
 IDE supports D and works just fine, but i cant seem to get derelict 
 working with it (i get plenty of undefined symbol errors when i try to 
 complie sdl stuff with it).
 
 Complier output. This is when compiling dmedia opengl tutorial:
 
 --- cutpaste ---
 ::  Symbol Undefined _glMatrixMode
 ::  Symbol Undefined _glLoadIdentity
 ::  Symbol Undefined _gluPerspective
 ::  Symbol Undefined _D8derelict3sdl3sdl16DerelictSDL_LoadFZv
 ::  Symbol Undefined _D8derelict6opengl2gl15DerelictGL_LoadFZv
 ::  Symbol Undefined _D8derelict6opengl3glu16DerelictGLU_LoadFZv
 ::  Symbol Undefined _SDL_Init
 ::  Symbol Undefined _SDL_GL_SetAttribute
 ::  Symbol Undefined _SDL_SetVideoMode
 ::  Symbol Undefined _SDL_WM_SetCaption
 ::  Symbol Undefined _SDL_PollEvent
 ::  Symbol Undefined _glClear
 ::  Symbol Undefined _SDL_GL_SwapBuffers
 ::  Symbol Undefined _SDL_Quit
 ::  Symbol Undefined _D8derelict6opengl3glu18DerelictGLU_UnloadFZv
 ::  Symbol Undefined _D8derelict6opengl2gl17DerelictGL_UnloadFZv
 ::  Symbol Undefined _D8derelict3sdl3sdl18DerelictSDL_UnloadFZv
 ::  Symbol Undefined _glBegin
 ::  Symbol Undefined _glColor3f
 ::  Symbol Undefined _glVertex3f
 ::  Symbol Undefined _glEnd
 ---/cutpaste---
Make sure the derelict modules are on your import path.
May 09 2006
next sibling parent reply Jarno Tuomainen <zorbuz gmail.com> writes:
Mike Parker wrote:

 Make sure the derelict modules are on your import path.
They should be. Because if i break paths, error goes like this: //cut main.d:2: module sdl cannot read file 'sdl.d' //paste So, i think something else is messed up here. Ofcourse, i can build stuff in dos prompt (derelict works just fine there), but because i use codeblocks to write code, dropping to dos and compiling stuff feels bit clumsy.
May 10 2006
next sibling parent reply Mike Parker <aldacron71 yahoo.com> writes:
Jarno Tuomainen wrote:
 Mike Parker wrote:
 
 Make sure the derelict modules are on your import path.
They should be. Because if i break paths, error goes like this: //cut main.d:2: module sdl cannot read file 'sdl.d' //paste So, i think something else is messed up here. Ofcourse, i can build stuff in dos prompt (derelict works just fine there), but because i use codeblocks to write code, dropping to dos and compiling stuff feels bit clumsy.
Ah, of course. Missing symbols means the libraries aren't on the linker path. Make sure to add them in the project properties.
May 10 2006
parent reply Jarno Tuomainen <zorbuz gmail.com> writes:
Mike Parker wrote:
 Ah, of course. Missing symbols means the libraries aren't on the linker 
 path. Make sure to add them in the project properties.
Had time to play it bit more today and had little progress. Doesnt rant about symbols anymore, but now i get error: -------------- Build: Release in sdl --------------- Compiling: main.d Error: unrecognized switch '-O2' Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings
May 11 2006
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Jarno Tuomainen wrote:

 Doesnt rant about symbols anymore, but now i get error:
 
 -------------- Build: Release in sdl ---------------
 Compiling: main.d
 Error: unrecognized switch '-O2'
 Process terminated with status 1 (0 minutes, 0 seconds)
 0 errors, 0 warnings
It's called "-O2" in GDC, but in DMD it's instead called "-O" If this was from the settings for the DMD compiler, it's a bug. --anders
May 11 2006
prev sibling parent Mike Parker <aldacron71 yahoo.com> writes:
Jarno Tuomainen wrote:
 Mike Parker wrote:
 Ah, of course. Missing symbols means the libraries aren't on the 
 linker path. Make sure to add them in the project properties.
Had time to play it bit more today and had little progress. Doesnt rant about symbols anymore, but now i get error: -------------- Build: Release in sdl --------------- Compiling: main.d Error: unrecognized switch '-O2' Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings
By default, Code::Blocks sets the compiler for D projects to be "GNU GDC Compiler" at project creation. When creating projects, make sure you select "Digital Mars D Compiler" if you are using DMD rather than GDC. If you have created a project with the wrong compiler you can still switch the configuration by going, in the menu, to Project->Build Options. The dialog that pops up will have a tree on the left: Project Name | |-- Debug |-- Release Select "Project Name". On the right side is a drop down list named "Selected Compiler". If it is not set to "Digital Mars D Compiler", find it in the list and select it. Unfortunately, changing the compiler selection in the root configuration does not change it in the Debug and Release configurations. You will need to select each node and do the same thing.
May 11 2006
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Jarno Tuomainen wrote:

 So, i think something else is messed up here.
 
 Ofcourse, i can build stuff in dos prompt (derelict works just fine 
 there), but because i use codeblocks to write code, dropping to dos and 
 compiling stuff feels bit clumsy.
I think the Derelict library uses "pragma(lib)" to load the libraries (e.g. derelictUtil and derelictSDL) This should work when doing a "one-pass" build/dmd from the commandline, but when you are working with something closer to the "Make" build analogy (like Code::Blocks does) then it probably compiles the code in the first pass and then links them together in a second link run. And it is possible that this second run doesn't pick up on pragma(lib) ? Try including the D libraries explicitly, in Code::Blocks ? If this works OK, then you have run into this issue - which is the same as what you get when running GDC and GNU Make. (GDC does not support the pragma(lib), for linking libraries) Code::Blocks uses the same model as C/C++, if that helps you. --anders
May 10 2006
parent reply Mike Parker <aldacron71 yahoo.com> writes:
Anders F Björklund wrote:
 Jarno Tuomainen wrote:
 I think the Derelict library uses "pragma(lib)" to
 load the libraries (e.g. derelictUtil and derelictSDL)
Incorrect. None of the packages do that. Only the examples.
May 11 2006
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Mike Parker wrote:

 I think the Derelict library uses "pragma(lib)" to
 load the libraries (e.g. derelictUtil and derelictSDL)
Incorrect. None of the packages do that. Only the examples.
Sorry, my bad. And it seemed that the OP got it fixed anyway. --anders
May 11 2006
prev sibling parent reply OoPs-Tk <Kross_t hotmail.com> writes:
I am just starting out in C++ one tut I have been using give me a
roll dice program pretty much I have followed his steps perfectly
but an dgetting this:

.objs\main.o:main.cpp:(.text+0x13f): undefined reference to
`rollDice()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

everytime I try and build. I am using codeblocks.

Below is a copy of the code I am using any help would be much
appreciated.


#include <iostream>
#include <ctime>

using namespace std;

void rollDice (void);

 int main()

{
    srand(time (0));

	rollDice();

	return 0;
}

void rolldice(void)
{
    int die1;
    int die2;

    die1 = 1 + rand() % 6;
    die2 = 1 + rand() % 6;
    cout <<"the first dice is"<<die1 <<endl;
    cout <<"the second dice is"<<die2 <<endl;
}
Dec 20 2006
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
OoPs-Tk wrote:
 I am just starting out in C++ one tut I have been using give me a
 roll dice program pretty much I have followed his steps perfectly
 but an dgetting this:
Um... this is a newsgroup for the D programming language. You should ask this on a C++ newsgroup. (But hint -- C++ is case-sensitive. rolldice!=rollDice). --bb
 
 .objs\main.o:main.cpp:(.text+0x13f): undefined reference to
 `rollDice()'
 collect2: ld returned 1 exit status
 Process terminated with status 1 (0 minutes, 0 seconds)
 0 errors, 0 warnings
 
 everytime I try and build. I am using codeblocks.
 
 Below is a copy of the code I am using any help would be much
 appreciated.
 
 
 #include <iostream>
 #include <ctime>
 
 using namespace std;
 
 void rollDice (void);
 
  int main()
 
 {
     srand(time (0));
 
 	rollDice();
 
 	return 0;
 }
 
 void rolldice(void)
 {
     int die1;
     int die2;
 
     die1 = 1 + rand() % 6;
     die2 = 1 + rand() % 6;
     cout <<"the first dice is"<<die1 <<endl;
     cout <<"the second dice is"<<die2 <<endl;
 }
 
 
Dec 20 2006