473,883 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(s tring theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountF ull.c_str());
system(rmdirFul l.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 6698
el*****@gmail.c om 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(s tring theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountF ull.c_str());
system(rmdirFul l.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 TrainTrafficKin g
* Will allow user to install game to directory of choice
*/
#include <iostream>
#include <fstream>
using namespace std;

class install
{
/*void mountSource(str ing);
string getDestination( );
void checkDesExists( string);
void createDest(stri ng);
void installGame(str ing, string);
void unmountSource(s tring); */

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

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

cout<<"Preparin g 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(sou rce);
destination = getDestination( );
createDest(dest ination);
installGame(sou rce, destination);
unmountSource(s ource);
cout << "Thank you for installing Train TrafficKing";
}
/* EMethod */
/* EProxy */

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

string mkdir = "mkdir ";
string source = theSource;
string mkdirFull = mkdir + source;
string mount = "mount /dev/cdrom -t 9660 ";
string mountFull = mount + source;
system(mkdirFul l.c_str());
system(mountFul l.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(stri ng theDestination)
{
string destination = theDestination;
string rmdir = "rm -r ";
string rmdirFull = rmdir + destination;
string mkdir = "mkdir ";
string mkdirFull = mkdir + destination;
system(rmdirFul l.c_str());
system(mkdirFul l.c_str());
}
/* EMethod */
/* EProxy */

/* Proxy installGame I/O */
/* Method installgame */
void installGame(str ing 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(s tring theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountF ull.c_str());
system(rmdirFul l.c_str());
}
/* EMethod */
/* EProxy */

/* End Installer */
}

Apr 22 '07 #3
el*****@gmail.c om 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<<"Preparin g 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(sou rce);
destination = getDestination( );
createDest(dest ination);
installGame(sou rce, destination);
unmountSource(s ource);
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.c om wrote:
Here is the full code (its fairly short):

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

#include <iostream>
#include <fstream>

using namespace std;

class install
{
/*void mountSource(str ing);
string getDestination( );
void checkDesExists( string);
void createDest(stri ng);
void installGame(str ing, string);
void unmountSource(s tring); */

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

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

cout<<"Preparin g 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(sou rce);
destination = getDestination( );
createDest(dest ination);
installGame(sou rce, destination);
unmountSource(s ource);
cout << "Thank you for installing Train TrafficKing";}

/* EMethod */
/* EProxy */

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

string mkdir = "mkdir ";
string source = theSource;
string mkdirFull = mkdir + source;
string mount = "mount /dev/cdrom -t 9660 ";
string mountFull = mount + source;
system(mkdirFul l.c_str());
system(mountFul l.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(stri ng theDestination)
{
string destination = theDestination;
string rmdir = "rm -r ";
string rmdirFull = rmdir + destination;
string mkdir = "mkdir ";
string mkdirFull = mkdir + destination;
system(rmdirFul l.c_str());
system(mkdirFul l.c_str());}

/* EMethod */
/* EProxy */

/* Proxy installGame I/O */
/* Method installgame */
void installGame(str ing 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(s tring theSource)
{
string source = theSource;
string unmount = "unmount ";
string unmountFull = unmount + source;
string rmdir = "rmdir ";
string rmdirFull = rmdir + source;
system(unmountF ull.c_str());
system(rmdirFul l.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
8632
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 build my gui and dll projects, whose project, workspace, source files all resided on network drive mapped to H. The H mapping,
2
17581
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 compiler as the page is requested by the browser. The result is that the "compiler failed with error code 2000". I have tested the same code on another workstation with VS.NET and it works fine EVERY time. I'm convinced it's not the code and I...
10
2580
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 forgets to implement some method I normally get a compile error(if the class is created in some way of course). When using the Visual Studio 6 compiler however, it does not generate a compile error in this case: - I have a implementing class A...
2
5848
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 create a dll, using the cl compiler I was getting many unresolved external errors, Example 1 below (8 in total, 7 to do with the registry function calls and 1 from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I created a LINK...
0
2407
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 this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the
1
13273
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 error has occurred in the compiler. To work around this problem,
3
5271
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 (0xc0000005 at address 535F072A): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are...
4
3331
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 property 'DocItem' should be 'DocItems.' The problem is that instead of notifying me of where the problem has occurred, the compiler just crashes with an "internal error" (see bottom of this message). Now if I were to write: ...
6
2732
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 facing the same problem with many of them: I keep getting errors such as: ....\WinUser.h(8028): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701)
27
3090
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 the source (gcc-4.3.1/gcc/c-common.c) of gcc 4.3.1, is a syntax error. I'm inclined to agree, as it is like no C I have ever met. what is "C_COMMON_FIXED_TYPES (, fract);" supposed to mean? Could it be
0
9943
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9793
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11151
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10858
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9577
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5996
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4619
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.