5 Replies - 3946 Views - Last Post: 10 October 2010 - 10:46 AM Rate Topic: -----

#1 maldiyani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 08-November 08

include a header file from directory

Posted 10 October 2010 - 10:03 AM

Hi fellas,
it seems simple but i can not do it. im started to work on nvidia cuda with visual studio. however when i try to include a header from a far directory, it fails to build.
for example i want to use "cutil.h" in my program and this header file is in this directory: "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc"
im adding this path into Project properties -> Configuration Properties -> Linker -> General -> Additional Library Directories it can not build. it says "Cannot open include file: 'cutil.h': No such file or directory"

How can i include it? What did i miss?
Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: include a header file from directory

#2 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: include a header file from directory

Posted 10 October 2010 - 10:06 AM

Quote

m adding this path into Project properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
Wrong one.

You are specifying the header search path. This has nothing to do with the linker and lib search path. You want to specify additional include directories. It's under the C/C++ options. There should be a place somewhere to add additional header search paths.
Was This Post Helpful? 0
  • +
  • -

#3 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 710
  • View blog
  • Posts: 2,033
  • Joined: 20-March 10

Re: include a header file from directory

Posted 10 October 2010 - 10:10 AM

Either put it in your compilers include directory
or put it where your main projects .cpp file is

and
#include <cutil.h>
or
#include "cutil.h"

respectively.

This post has been edited by snoopy11: 10 October 2010 - 10:11 AM

Was This Post Helpful? 0
  • +
  • -

#4 maldiyani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 08-November 08

Re: include a header file from directory

Posted 10 October 2010 - 10:18 AM

View PostOler1s, on 10 October 2010 - 09:06 AM, said:

Quote

m adding this path into Project properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
Wrong one.

You are specifying the header search path. This has nothing to do with the linker and lib search path. You want to specify additional include directories. It's under the C/C++ options. There should be a place somewhere to add additional header search paths.

i tried tools->options->project and solutions->VC++ directories and add include directories this the path which i mentioned. however, nothing changed:/

i think it has a simple solution but i can not find it.

View Postsnoopy11, on 10 October 2010 - 09:10 AM, said:

Either put it in your compilers include directory
or put it where your main projects .cpp file is

and
#include <cutil.h>
or
#include "cutil.h"

respectively.

it has a lot of dependicies with other files. i can not put it near the source file.
how can do other way? can you explain?
Was This Post Helpful? 0
  • +
  • -

#5 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 710
  • View blog
  • Posts: 2,033
  • Joined: 20-March 10

Re: include a header file from directory

Posted 10 October 2010 - 10:32 AM

As I said you can copy paste it into your compilers include directory

if you are using MSVC its Program Files->Microsoft Visual Studio->VC

if it has dependecies with other header files then you can copy them there too.
Was This Post Helpful? 0
  • +
  • -

#6 maldiyani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 08-November 08

Re: include a header file from directory

Posted 10 October 2010 - 10:46 AM

View Postsnoopy11, on 10 October 2010 - 09:32 AM, said:

As I said you can copy paste it into your compilers include directory

if you are using MSVC its Program Files->Microsoft Visual Studio->VC

if it has dependecies with other header files then you can copy them there too.

is there an elegant solution. no offense. your solution is not bad however i can not do it all the time.
i think there is lib file and header files. including lib files make us use headers. am i correct?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1