Author Topic: File path for header files  (Read 28050 times)

Offline H

  • Multiple posting newcomer
  • *
  • Posts: 15
File path for header files
« on: July 31, 2009, 11:30:25 pm »
I downloaded FLTK (Fast Light Toolkit) and I'm having trouble using the header files in it. Normally I store all of my C++ files and header files in a separate folder located in my User folder. However, when I extracted the FLTK folder(which holds the files) into this folder, and tried to compile a program that includes some of the header files, it was unable to locate them. Is there a place I should put the FLTK folder so the compiler will be able to access it, or a way to specify a file path to look for header files?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File path for header files
« Reply #1 on: August 01, 2009, 01:00:30 am »
project -> build options ->search directories -> (compiler or linker)

note that you can set directories to be project or target specific (manage your targets in project -> properties)

you can also declare global variables that reside in your user settings, so that you don't have to hardcode paths in your project files.

see also:
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks
http://wiki.codeblocks.org/index.php?title=Global_compiler_variables
http://wiki.codeblocks.org/index.php?title=Builtin_variables



Offline H

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: File path for header files
« Reply #2 on: August 01, 2009, 03:25:37 am »
Build options is greyed out. I'm not in a project, it's just a C++ file.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File path for header files
« Reply #3 on: August 01, 2009, 05:26:47 am »
you can also set global directories in settings -> compiler and debugger. but why not just make a project?

Offline H

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: File path for header files
« Reply #4 on: August 01, 2009, 06:08:03 am »
I'm self learning and am doing lots of individual small exercises, so I don't want to make a project for every one, or make the whole thing one big project.

So if I select put under search directories a folder with other folders in it, will it read into those too? I'm still running into compiler errors and I'm thinking it's because I need to specify every sub folder that needs to be read into. The file path kind of looks like this...

C:/Users/Alex/C++/ftlk

Then there are lots of folders in ftlk with headers in them. However, all I added in to the search directories was what I listed above. Do I need to specify all of the directories inside of ftlk as well?
« Last Edit: August 01, 2009, 06:14:18 am by H »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: File path for header files
« Reply #5 on: August 01, 2009, 09:29:55 am »
yes, unless you specify the includes in your code, with subpaths starting from the point you added to the search paths (that is : relative to C:/Users/Alex/C++/ftlk).


Offline H

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: File path for header files
« Reply #6 on: August 02, 2009, 04:46:30 am »
All right I got it. This isn't directly related to the compiler but I figured I would post it anyway. The compiler generates an error when trying to access certain functions in the cmath header such as..

using ::acos    //::acos has not been declared

Does anyone know where the functions in the cmath header come from? Because all of the functions in it generate compiler errors.

Offline H

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: File path for header files
« Reply #7 on: August 02, 2009, 05:13:55 am »
Well I tried just running a normal input/output program, and the compiler can't find the iostream directory? What is up?

Edit: Saving new files as C files rather than C++ files.....?
« Last Edit: August 02, 2009, 05:19:01 am by H »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: File path for header files
« Reply #8 on: August 03, 2009, 07:32:08 am »
This is *not* a general development forums. Thus your post(s) violate our forum rules.

Please try a C::B book or a C/C++ dedicated forum. Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ