473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Compiler Error

I am getting this error on compile "expected unqualified-id at end of
input".

Here is the block of code that generates the error:

/* Proxy unmountSource I/O */
/* Method unmountSource */
void unmountSource(string theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountFull.c_str());
system(rmdirFull.c_str());
}
/* EMethod */
/* EProxy */

Compiler points to the line that has the end curly brace. Any ideas or
at least what the error means?

Apr 22 '07 #1
4 6654
el*****@gmail.com wrote:
I am getting this error on compile "expected unqualified-id at end of
input".

Here is the block of code that generates the error:

/* Proxy unmountSource I/O */
/* Method unmountSource */
void unmountSource(string theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountFull.c_str());
system(rmdirFull.c_str());
}
/* EMethod */
/* EProxy */

Compiler points to the line that has the end curly brace. Any ideas or
at least what the error means?
There's nothing wrong with the above, assuming string is an alias for
std::string, so the error is somewhere else.

Post a minimal compilable example that demonstrates your problem.

--
Ian Collins.
Apr 22 '07 #2
Here is the full code (its fairly short):

/*
* Installer for TrainTrafficKing
* Will allow user to install game to directory of choice
*/
#include <iostream>
#include <fstream>
using namespace std;

class install
{
/*void mountSource(string);
string getDestination();
void checkDesExists(string);
void createDest(string);
void installGame(string, string);
void unmountSource(string); */

/* Proxy Main Logic */
/* Method Main */
int main()
{

string destination;
string source = "/mnt/TrafficKing";

cout<<"Preparing to install Train TrafficKing..." << "/n" << "You must
have root privileges to install this game." << "/n" << "If you do NOT
have root privileges, please contact your System Administrator." << "/
n" ;

mountSource(source);
destination = getDestination();
createDest(destination);
installGame(source, destination);
unmountSource(source);
cout << "Thank you for installing Train TrafficKing";
}
/* EMethod */
/* EProxy */

/* Proxy mountSource I/O */
/* Method mountSource */
void mountSource(string theSource)
{

string mkdir = "mkdir ";
string source = theSource;
string mkdirFull = mkdir + source;
string mount = "mount /dev/cdrom -t 9660 ";
string mountFull = mount + source;
system(mkdirFull.c_str());
system(mountFull.c_str());
}
/* EMethod */
/* EProxy */

/* Proxy getDestination I/O */
/* Method getDestination */
string getDestination()
{
string destination;
cout<< "Please enter a destination to install Train TrafficKing";
cin >destination;
return destination;
}
/* EMethod */
/* EProxy */

/* Proxy createDest I/O */
/* Method createDest */
void createDest(string theDestination)
{
string destination = theDestination;
string rmdir = "rm -r ";
string rmdirFull = rmdir + destination;
string mkdir = "mkdir ";
string mkdirFull = mkdir + destination;
system(rmdirFull.c_str());
system(mkdirFull.c_str());
}
/* EMethod */
/* EProxy */

/* Proxy installGame I/O */
/* Method installgame */
void installGame(string theSource, string theDestination)
{
string destination = theDestination;
string source = theSource;
string copy = "cp -R ";
string copyFull = copy + source + " " + destination;
system(copyFull.c_str());
}
/* EMethod */
/* EProxy */

/* Proxy unmountSource I/O */
/* Method unmountSource */
void unmountSource(string theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountFull.c_str());
system(rmdirFull.c_str());
}
/* EMethod */
/* EProxy */

/* End Installer */
}

Apr 22 '07 #3
el*****@gmail.com wrote:
Here is the full code (its fairly short):
I can see two reasons why it won't compile:
int main()
{

string destination;
string source = "/mnt/TrafficKing";

cout<<"Preparing to install Train TrafficKing..." << "/n" << "You must
have root privileges to install this game." << "/n" << "If you do NOT
have root privileges, please contact your System Administrator." << "/
n" ;

mountSource(source);
destination = getDestination();
createDest(destination);
installGame(source, destination);
unmountSource(source);
cout << "Thank you for installing Train TrafficKing";
}
Missing return.
/* End Installer */
}
Missing semicolon.

--
Ian Collins.
Apr 22 '07 #4
On Apr 22, 5:57 pm, elSh...@gmail.com wrote:
Here is the full code (its fairly short):

/*
* Installer for TrainTrafficKing
* Will allow user to install game to directory of choice
*/

#include <iostream>
#include <fstream>

using namespace std;

class install
{
/*void mountSource(string);
string getDestination();
void checkDesExists(string);
void createDest(string);
void installGame(string, string);
void unmountSource(string); */

/* Proxy Main Logic */
/* Method Main */
int main()
{

string destination;
string source = "/mnt/TrafficKing";

cout<<"Preparing to install Train TrafficKing..." << "/n" << "You must
have root privileges to install this game." << "/n" << "If you do NOT
have root privileges, please contact your System Administrator." << "/
n" ;

mountSource(source);
destination = getDestination();
createDest(destination);
installGame(source, destination);
unmountSource(source);
cout << "Thank you for installing Train TrafficKing";}

/* EMethod */
/* EProxy */

/* Proxy mountSource I/O */
/* Method mountSource */
void mountSource(string theSource)
{

string mkdir = "mkdir ";
string source = theSource;
string mkdirFull = mkdir + source;
string mount = "mount /dev/cdrom -t 9660 ";
string mountFull = mount + source;
system(mkdirFull.c_str());
system(mountFull.c_str());}

/* EMethod */
/* EProxy */

/* Proxy getDestination I/O */
/* Method getDestination */
string getDestination()
{
string destination;
cout<< "Please enter a destination to install Train TrafficKing";
cin >destination;
return destination;}

/* EMethod */
/* EProxy */

/* Proxy createDest I/O */
/* Method createDest */
void createDest(string theDestination)
{
string destination = theDestination;
string rmdir = "rm -r ";
string rmdirFull = rmdir + destination;
string mkdir = "mkdir ";
string mkdirFull = mkdir + destination;
system(rmdirFull.c_str());
system(mkdirFull.c_str());}

/* EMethod */
/* EProxy */

/* Proxy installGame I/O */
/* Method installgame */
void installGame(string theSource, string theDestination)
{
string destination = theDestination;
string source = theSource;
string copy = "cp -R ";
string copyFull = copy + source + " " + destination;
system(copyFull.c_str());}

/* EMethod */
/* EProxy */

/* Proxy unmountSource I/O */
/* Method unmountSource */
void unmountSource(string theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountFull.c_str());
system(rmdirFull.c_str());}

/* EMethod */
/* EProxy */

/* End Installer */

}
What follows is not a class:

class A
{
}

But this is:

class A
{
};

You should
#include <string>
if you plan to use std::string and pass it by reference to functions
or you'll end up invoking std::string copy ctor unneccessarily. Not to
mention that you'ld be modifying a local only.

void foo( std::string& r_s ) // or const std::string&
{
// do stuff with r_s
}

All of the above is basic, fundamental, unavoidable, required
knowledge.
What book are you reading?
Apr 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to...
2
by: Mike Fisher | last post by:
I'm seeing an error when I try to run/debug a web service. Although it doesn't happen every time, it does occur more than half of the times I hit F5. It appears to be returned by the the JIT...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
2
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
0
by: rollasoc | last post by:
Hi, I seem to be getting a compiler error Internal Compiler Error (0xc0000005 at address 535DB439): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around...
1
by: Ayende Rahien | last post by:
reparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error (0xc0000005 at address 53168B12): likely culprit is 'BIND'. An internal...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
4
by: David Sworder | last post by:
Consider the following line of code (it's not important what it does): resp.DocItem=Relations.SelectDocItems_BySearchString(req.SearchPhrase); It turns out that this line is in error. The...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.