Page 1 of 1

Problem running script

Posted: 11.06.2004, 18:48
by lex
Im trying to edit the program so that when a key is pressed it runs a script. Here is what I have so far. I think I have only changed the celestiacore.cpp file.

Code: Select all

 
    void CelestiaCore::charEntered(char c)
   {
      Observer* observer = sim->getActiveObserver();
     
      if (c == 'e' || c == 'E')
      {
        std::string scriptfile="c:\\celestia\\demo.cel";
         CommandParser parser(scriptfile);
         CommandSequence* script = parser.parse();
         CelestiaCore::cancelScript(); // cancel any running script
         CelestiaCore::runScript(script);
      }


when I try to compile I Get the following error


Code: Select all

 
        cd ..
        cd celestia
        nmake /NOLOGO celestia.mak CFG=Release
        rc /l 0x409 /d "NDEBUG" /fo .\Release\celestia.res /i "res" .\res\celest
ia.rc
        cl.exe @C:\DOCUME~1\Lex\LOCALS~1\Temp\nma02472.
celestiacore.cpp
celestiacore.cpp(1055) : error C2664: '__thiscall CommandParser::CommandParser(c
lass std::basic_istream<char,struct std::char_traits<char> > &)' : cannot conver
t parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,c
lass std::allocator<char> >' to 'class std::basic_istream<char,struct std::char_
traits<char> > &'
        A reference that is not to 'const' cannot be bound to a non-lvalue
configfile.cpp
eclipsefinder.cpp
favorites.cpp
ODMenu.cpp
url.cpp
wineclipses.cpp
wingotodlg.cpp
winbookmarks.cpp
winhyperlinks.cpp
winlocations.cpp
winssbrowser.cpp
winstarbrowser.cpp
winviewoptsdlg.cpp
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~2\VC98\BIN\NMAKE.EXE' : return co
de '0x2'
Stop.



Any thought would be appreciated.
-Lex

Re: Problem running script

Posted: 12.06.2004, 01:57
by Harry
Try:

Code: Select all

 
[...]     
      if (c == 'e' || c == 'E')
      {
        std::string scriptfile="c:\\celestia\\demo.cel";
         CelestiaCore::runScript(scriptfile);
      }

Harald

Posted: 12.06.2004, 02:07
by chris
One other suggestion: replace the double backslashes in the filename with a single forward slash. The backslash is only a valid path separator on Windows, whereas the forward slash is portable across all OSes. And it's less typing.

--Chris