Code::Blocks Forums
User forums => Help => Topic started by: Nacho on January 16, 2006, 08:30:41 pm
-
Hi! I´m trying to compile an SDL project -created using the CodeBlock´s template for SDL projects- which includes a few source files. After a successful compilation I get linker errors about "undefined references" from my own´s source files. As a simple test I tried the following piece of code, but the error is still there (I get an undefined reference to Vector2DFPDotProd).
#include "MathLibFP.h"
int
main(int argc,char** argv)
{
Vector2DFPType VecA = {1.0f,1.0f}, VecB = {1.0f,1.0f};
Vector2DFPDotProd(&VecA,&VecB);
return 0;
}
I tried cleaning the project and rebuilding, but nothing. Here´s a piece of the project´s makefile:
.deps/MathLibFP.d: MathLibFP.c
@echo Calculating dependencies for "MathLibFP.c"...
@$(default_CC) -MM $(default_CFLAGS) -MF .deps/MathLibFP.d -MT .objs/MathLibFP.o $(default_INCS) MathLibFP.c
.objs/MathLibFP.o: .deps/MathLibFP.d
@echo Compiling "MathLibFP.c"...
@$(default_CC) $(default_CFLAGS) $(default_INCS) -c MathLibFP.c -o .objs/MathLibFP.o
which shows that MathLibFP.c is being compiled. Any suggestions on how to solve this??
Thanks in advance!
--Nacho
-
Hello,
May be this topic (http://forums.codeblocks.org/index.php?topic=1962.0) could be useful for you.
I would also advice a search in the forum :). There are already some posts about SDL that could be useful for solve your problem.
Michael
-
Thanks for the link, but my current problem is not related with SDL´s files but with some of my own files (MathLibFP.c/h, for example) that do not contain any SDL code at all. In fact, the SDL program that gets automatically created by CB works ok.
I also searched in the forum but most threads were on "undefined references" obtained by programmers who wanted to compile CB´s source code, which is not my case. Although I did found this thread: http://forums.codeblocks.org/index.php?topic=947.0 (http://forums.codeblocks.org/index.php?topic=947.0), that mentions somethings closely related to the problem I´m experiencing:
- the compiler sometimes gives messages like undefined reference to function f @ some point in some file where that function is not even used :p. Well I know that this is not a very good description, but...
Thanks again for your input!
--Nacho
-
Ok, sorry :oops:.
Which version of C::B are you using? And which OS?
Michael
-
Ok, sorry :oops:.
Eh, no problem! Please, don´t feel bad about it. :)
Anyway, I came here to tell you that I finally fixed it, but the steps I took to arrive at the solution are a little bit weird: I removed main.cpp (the one that gets automatically generated by CB SDL´s template), renamed it to blabla.cpp, created and included a new file called main.c, copied the contents from blabla.cpp to main.c and rebuilt the whole project.
I´m using the latets version of CB (the one that includes MinGW) and WinXP. Although I solved my problem, I´d like to know if somebody else has ever experienced a similar problem.
Michael, thanks again for your reply!
--Nacho
-
Hello,
If you use RC2 (i.e., the one that come bundle or not with MinGW), then I would advice you to give a try to the latest nightly build. A lot of bugs have been fixed since then and new features added.
May be a nightly build would work better for you.
Best wishes,
Michael
PS.: You can also compile SVN source by yourself. It is VERY EASY and it is worth.
-
Michael: I´m using RC2 but I´ll try to compile the nightly build during the weekend and let you know if I succeded at it.
--Nacho
-
Michael: I´m using RC2 but I´ll try to compile the nightly build during the weekend and let you know if I succeded at it.
The nightly builds are already compiled. You should download and install TortoiseSVN and use it to download C::B sources. Be careful becasue the C::B project has changed of name. Now it is called CodeBlocks.cbp.
If you encounter some problems, just post :).
Michael
-
codeblocks.cbp? So we should delete the codeblocks-NewBUILD.cbp?
-
codeblocks.cbp? So we should delete the codeblocks-NewBUILD.cbp?
Hint: svn update :D
-
codeblocks.cbp? So we should delete the codeblocks-NewBUILD.cbp?
It is already done :D. In revision1797 Mandrav has "Removed "NewBuild" suffix from all project files.".
As Takeshi Miya suggested, just do an update with e.g., TortoiseSVN.
Michael