gcc preprocessor and environment variables

This is a discussion on gcc preprocessor and environment variables within the C Programming forums, part of the General Programming Boards category; im trying to to use environment variables in source files with gcc. in my .bash_profile i have something like "export ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    913

    gcc preprocessor and environment variables

    im trying to to use environment variables in source files with gcc.

    in my .bash_profile i have something like "export str="/home/martin"" i can echo $str and get =/home/martin but when i try it with #include i get that the file cant be found, why? how should i do it?
    Last edited by mart_man00; 06-06-2003 at 06:11 PM.

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    acually i just wanted that directory. i wanted to pull of something like

    #include "$str/my_string.c"

    can i do that?

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    i have to compiled with a seperate command? im i not using a escape character or something when is use #include?

    >// why are you #include'ing source files anyway?
    i just picked a name. i just wanted to get it working and had more .c's in front of me than .h's.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best way to avoid using global variables
    By Canadian0469 in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2008, 11:02 AM
  2. Replies: 15
    Last Post: 09-30-2008, 02:12 AM
  3. Compiles on gcc 3.3 but not on gcc 4.0.3
    By cunnus88 in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2007, 12:24 PM
  4. gcc configuration under linux advice needed
    By vart in forum Tech Board
    Replies: 9
    Last Post: 01-10-2007, 01:46 PM
  5. Mixing gcc 2.9* with gcc 3.*
    By rotis23 in forum Linux Programming
    Replies: 1
    Last Post: 07-19-2003, 12:21 AM

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