Problem running script

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
lex
Posts: 3
Joined: 09.06.2004
With us: 20 years 5 months

Problem running script

Post #1by lex » 11.06.2004, 18:48

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

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Re: Problem running script

Post #2by Harry » 12.06.2004, 01:57

Try:

Code: Select all

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

Harald

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #3by chris » 12.06.2004, 02:07

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


Return to “Development”