Answer the question
In order to leave comments, you need to log in
How to fix an error in Embarcadero RAD STUDIO XE7 when specifying an argument type for a function?
Good afternoon!
I used to write sites in php and Yii, I decided to master C++ and components of the Embarcadero RAD STUDIO XE7 Development Environment. Experimenting with small console programs.
I use Embarcadero RAD STUDIO XE7 on a Virtual BOX virtual machine under WIN7. I literally did the exercises according to the book by Bjarne Stroustrup, everything compiled remarkably. But today, having enabled Embarcadero, when compiling yesterday's code, I found 51 errors:
[bcc32 Error] iosfwd(129): E2102 Cannot use template 'streampos' without specifying specialization parameters
Full parser context
File1.cpp(1): #include C:\Program Files ( x86)\Embarcadero\Studio\15.0\include\boost_1_39\boost\tr1\tr1\algorithm
algorithm(16): #include C:\Program Files (x86)\Embarcadero\Studio\15.0\include\boost_1_39\boost/tr1/detail/config_all.hpp
config_all.hpp(155): #include c:\program files ( x86)\embarcadero\studio\15.0\include\../include/dinkumware/utility
utility(5): #include c:\program files (x86)\embarcadero\studio\15.0\include\dinkumware\iosfwd
iosfwd(9) : namespace std
When I commented out all the included libraries and lines of code using the functions of these libraries, the error was no longer displayed, but all the work was naturally in vain.
The forum advised to restart the Virtual Machine, I did so, but now the problem is the following.
After uncommenting the library connections and code, the following error began to appear:
bcc32 command line for "File1.cpp"
c:\program files (x86)\embarcadero\studio\15.0\bin\bcc32.exe -D_DEBUG -n.\Win32\Debug -IC:\DEVELOPER\Embarcadero\progects\carrots; "C:\Program Files
(x86)\Embarcadero\Studio\15.0\include\boost_1_39\boost\tr1\tr1";"C:\Program Files (x86)\Embarcadero\Studio\15.0\include\boost_1_39";"c :\program files
(x86)\embarcadero\studio\15.0\include";"c:\program files (x86)\embarcadero\studio\15.0\include\dinkumware";"c:\program files
(x86)\embarcadero\ studio\15.0\include\windows\crtl";"c:\program files (x86)\embarcadero\studio\15.0\include\windows\sdk";"c:\program files
(x86)\embarcadero\studio\15.0\ include\windows\rtl";"c:\program files (x86)\embarcadero\studio\15.0\include\windows\vcl";"c:\program files
(x86)\embarcadero\studio\15.0\include\windows\fmx";"C:\Program Files (x86)\FastReports\LibD21";"C:\Program Files (x86)\Raize\CS5\Lib\RS- XE7\Win32";
C:\Users\Public\Documents\Embarcadero\Studio\15.0\hpp\Win32 -y -Q -k -r- -c -tC -tM -C8 -o.\Win32\Debug\File1. obj -w-par -Od -v -vi-
-H=.\Win32\Debug\Project1.pch -H File1.cpp
[bcc32 Error] File1.cpp(28): E2147 'string' cannot start a parameter declaration
[ bcc32 Error] File1.cpp(30): E2147 'string' cannot start a parameter declaration
[bcc32 Error] File1.cpp(38): E2451 Undefined symbol 'cin'
Full parser context
File1.cpp(39): decision to instantiate: void keep_window_open()
--- Resetting parser context for instantiation...
File1.cpp(36): parsing: void keep_window_open()
[bcc32 Error] File1.cpp(509): E2034 Cannot convert 'char const[22]' to 'int'
Full parser context
File1.cpp(495): parsing: int area(int,int)
[bcc32 Error] File1.cpp(509): E2342 Type mismatch in parameter 's' (wanted 'int', got 'const char *')
Full parser context
File1.cpp(495): parsing : int area(int,int)
[bcc32 Error] File1.cpp(517): E2147 'string' cannot start a parameter declaration
[bcc32 Error] File1.cpp(518): E2451 Undefined symbol 'string'
Full parser context
File1. cpp(517): parsing: char ask_user(int)
[bcc32 Error] File1.cpp(518): E2379 Statement missing ;
Full parser context
File1.cpp(517): parsing: char ask_user(int)
[bcc32 Error] File1.cpp(519): E2451 Undefined symbol 'cin'
Full parser context
File1.cpp(517): parsing: char ask_user(int)
[bcc32 Error] File1.cpp(520): E2034 Cannot convert 'int' to 'const char *'
Full parser context
File1.cpp(517): parsing: char ask_user(int)
[bcc32 Error] File1.cpp(521): E2034 Cannot convert 'int' to 'const char *'
Full parser context
File1.cpp(517): parsing: char ask_user(int)
[bcc32 Error] File1.cpp(527): E2451 Undefined symbol 'cin'
Full parser context
File1. cpp(525): parsing: void some_func()
[bcc32 Error] File1.cpp(529): E2034 Cannot convert 'char const[41]' to 'int'
Full parser context
File1.cpp(525): parsing: void some_func()
[bcc32 Error] File1.cpp(529): E2342 Type mismatch in parameter 's' (wanted 'int', got 'const char *')
Full parser context
File1.cpp(525): parsing: void some_func()
[bcc32 Error] File1.cpp(536): E2147 'string' cannot start a parameter declaration
[bcc32 Error] File1.cpp(539): E2268 Call to undefined function 'runtime_error'
Full parser context
File1.cpp(536): parsing: void error(int)
i.e. For example, I have the following line in my function prototypes (28):
char ask_user(string); // The compiler swears at it, supposedly it is impossible to pass string
But the string library is included
(
I
provide
library connections, a prototype and descriptions of functions, there is no
output
,
errors
still
occur
)
: ;
#define _tmain main
#endif
int _tmain(int argc, _TCHAR* argv[])
{
// no output
//.... a lot of commented code with experiments
using namespace std;
system("pause");
return 0;
}
char ask_user(string answer){
string answer = " ";
cin >> answer;
if(answer == "y" || answer == "yes") return 'y';
else if(answer == "n" || answer == "no") return 'n';
else return 'b';
}
Lend a helping hand to those who faced such a problem
Answer the question
In order to leave comments, you need to log in
Decorate the question normally with code tags, etc., it's not readable.
In general, an unsuccessful choice of IDE and compiler for C ++, use Visual Studio (Express is free) or Qt Creator.
If you already come across Embarcadero, then Delphi is better than C ++ Builder, at least there is usually more information on it, it's easier to google. But it's better not to touch it all.
The only advice is not to mess with C ++ Builder, there is nowhere to comply with the standards below. If you need to take it out, then without the Visual Studio options, for starters, the free Express version (as @AlexP11223 said ). There are a lot of development environments for niks (Eclipse CDT, NetBeans, Anjuta, CodeBlocks, QT Creator, KDEvelop, etc.), the gcc compiler (g ++), poppies and clang (although the hose is also possible on niks).
The error was in the line:
string answer = " "; // no type needed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question