D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] c++ preprocessor passing strings

 

Hi Everyone,

Can't get my head around something that is probably very very simple

I have some code like this :-

std::string data_location
data_location = "/usr/local/hardcodedpath"

How can i set "/usr/local/hardcodedpath" at compile time?

Is there an easy C++ way of using preprocessors, i've tried passing
values over -DMY_LOCATION and using

data_location = MY_LOCATION

but as the string is unquoted this fails. It does not seem possible to
pass quoted values via the preprocessor.

The only thing i can think to do is to run sed at the file first?

Any other suggestions

TIA

Robin

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html