Thread: Tell compiler to look for include files

  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
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    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, 06:20 PM
  2. Compiler missing stdafx.h include file
    By jamort in forum C++ Programming
    Replies: 3
    Last Post: 02-10-2010, 04:03 AM
  3. Multiple Source Files, make files, scope, include
    By thetinman in forum C++ Programming
    Replies: 13
    Last Post: 11-05-2008, 11: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, 11:45 AM