Tell compiler to look for include files

This is a discussion on Tell compiler to look for include files within the C++ Programming forums, part of the General Programming Boards category; I'm trying to extend someone's work, but without success in including his header files appropriately. Namely, I compile the code ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    43

    Tell compiler to look for include files

    I'm trying to extend someone's work, but without success in including his header files appropriately. Namely, I compile the code by using
    Code:
    g++ -o myprog $(pkg-config --cflags --libs libgraph libgvc cairo) source.cpp source.c
    Now, I need to use the $ROOT/lib somehow to to tell the compiler to look in my
    ROOT directory for include files. How should my new code used for compilation look like?

    Thanks.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    If headers are in $ROOT/include and libs in $ROOT/lib then just add "-I$ROOT/include -L$ROOT/lib" to the command.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-06-2011, 05:20 PM
  2. Compiler missing stdafx.h include file
    By jamort in forum C++ Programming
    Replies: 3
    Last Post: 02-10-2010, 03:03 AM
  3. Multiple Source Files, make files, scope, include
    By thetinman in forum C++ Programming
    Replies: 13
    Last Post: 11-05-2008, 10:37 PM
  4. about #include files and header files
    By bulletbutter in forum C++ Programming
    Replies: 9
    Last Post: 04-18-2008, 10:24 AM
  5. include files that are'nt in compiler's directory
    By vaibhav in forum C++ Programming
    Replies: 10
    Last Post: 03-25-2006, 10:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21