Page 1 of 1

Detecting source files in other folders

Posted: Sun Nov 08, 2009 3:17 pm
by diego_pmc
Hello, I'm using the latest version, r19, and I am having some problems on compilation.
I want to use GRRLIB and I decided it would be better if instead of installing it in the compiler's include folder, I would just keep the only functions I need in my project and store the source of GRRLIB in the same place as the rest of my source code.

So my file tree looks like this:
  • Risen.pnproj
  • Makefile
  • sources
    • main.cpp
    • config.h
    • config.cpp
    • (etc.)
    • GRRLIB
      • grrlib.h
      • GRRLIB_render.c
      • (etc.)
When I try to compile it tells me that I have undefined references to the GRRLIB functions I am using, which I guess means it cannot find the source files where they are defined. But if I move all the header and source files of GRRLIB in the "sources" folder, these problems disappear.

Could someone please help me with this? Here's my project. I currently have two GRRLIB functions at the beginning main(); they are there for testing, I do not intend to leave them there. Also "gfx" folder and its contents are from Sand Traps, also for testing.

Re: Detecting source files in other folders

Posted: Sun Nov 08, 2009 5:34 pm
by vuurrobin
you need to add sources/GRRLIB to the source and include path in the makefile.

pretty much on top of the makefile is this:

Code: Select all

#---------------------------------------------------------------------------------
# TARGET is the name of the output. For it to be the directory name, write $(notdir $(CURDIR))
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET		:=	boot
BUILD		:=	build
SOURCES		:=	source
DATA		:=	data  
INCLUDES	:=

add sources/GRRLIB to the SOURCES and INCLUDES variable.