Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. static string username;
  2. static string password;
  3. static string db;
  4.  
  5. string Exchange::username = "user";
  6. string Exchange::password = "pass";
  7. string Exchange::db = "db";
  8.  
  9. int main()
  10. {
  11. Config cfg;
  12. try {
  13. cfg.readFile("/misc/config.json");
  14. }
  15. catch(const FileIOException &fioex) {
  16. std::cerr << "I/O error while reading file." << std::endl;
  17. return(EXIT_FAILURE);
  18. }
  19. catch(const ParseException &pex) {
  20. std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
  21. << " - " << pex.getError() << std::endl;
  22. return(EXIT_FAILURE);
  23. }
  24. Exchange::username = cfg.lookup("username");
  25. Exchange::password = cfg.lookup("password");
  26. Exchange::db = cfg.lookup("db");
  27. ...
  28.  
  29. error: 'std::string Exchange::username' is private
  30. string Exchange::username = "user";
  31. ^
  32. error: within this context
  33. Exchange::username = cfg.lookup("username");
  34. ^
  35. error: ambiguous overload for 'operator=' (operand types are 'std::string {aka std::basic_string<char>}' and 'libconfig::Setting')
  36. Exchange::username = cfg.lookup("username");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement