Hello,
Any way I can get a little help here? Getting the following errors when trying to compile my CPP file for DOS:
cd C:\WATCOM
wmake -f C:\WATCOM\PPID_Update.mk -h -e -a C:\WATCOM\PPID_update.obj
wpp PPID_update.cpp -i="C:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml -xs -xr
PPID_update.cpp(76): Error! E029: col(41) symbol 'getline' has not been declared
PPID_update.cpp(113): Error! E029: col(41) symbol 'getline' has not been declared
PPID_update.cpp(133): Error! E157: col(33) left expression must be integral
PPID_update.cpp(133): Note! N717: col(33) left operand type is 'std::ofstream (lvalue)'
PPID_update.cpp(133): Note! N718: col(33) right operand type is 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
Error(E42): Last command making (C:\WATCOM\PPID_update.obj) returned a bad status
Error(E02): Make execution terminated
Execution complete
Here is the source file:
// my first program in C++
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
string BeginLine, PartNum, EndLine, Rev;
string UCase (string Begin) {
int LineLen = 0, I;
for(I=0; I<=Begin[I]; I++)
LineLen++;
for (I=0; I < LineLen+1; I++){
if((Begin[I]>=97) && (Begin[I]<=122)){
Begin[I]=Begin[I]-32;
}
}
return Begin;
}
int UCase1 () {
int I;
for (I=0; I < 3; I++){
if((BeginLine[I]>=97) && (BeginLine[I]<=122)){
BeginLine[I]=BeginLine[I]-32;
}
}
for (I=0; I < 3; I++){
if((Rev[I]>=97) && (Rev[I]<=122)){
Rev[I]=Rev[I]-32;
}
}
for (I=0; I < 5; I++){
if((PartNum[I]>=97) && (PartNum[I]<=122)){
PartNum[I]=PartNum[I]-32;
}
}
for (I=0; I < 12; I++){
if((EndLine[I]>=97) && (EndLine[I]<=122)){
EndLine[I]=EndLine[I]-32;
}
}
return 0;
}
int PartChange () {
string PartLine, OldPart, NewPart;
BeginLine = UCase(BeginLine);
PartNum = UCase(PartNum);
EndLine = UCase(EndLine);
Rev = UCase(Rev);
// UCase1();
ifstream myfile3 ("PartNums.txt");
if (myfile3.is_open())
{
while (! myfile3.eof() )
{
getline (myfile3,PartLine);
OldPart = PartLine.substr(0,5);
NewPart = PartLine.substr(6,5);
if (PartNum == OldPart) {
PartNum = NewPart;
}
}
}
else cout << "Unable to open file";
// if (PartNum =="M3849") {
// PartNum ="FH175";
// }
return 0;
}
int main () {
string FullLine, PartLine, SampleLine1, SampleLine2;
// Open Output File
ofstream myfile2 ("Update.bat");
// Open Input File
ifstream myfile1 ("TEST.txt");
SampleLine1 = "Sysbrd Ser# => ";
SampleLine2 = "Sysbrd Ver => ";
// PartLine="0";
if (myfile2.is_open())
{
if (myfile1.is_open())
{
while (! myfile1.eof() )
{
getline (myfile1,FullLine);
PartLine = FullLine.substr(0,15);
if ( SampleLine1 == PartLine )
{
BeginLine = FullLine.substr(15,3);
PartNum = FullLine.substr(18,5);
EndLine = FullLine.substr(23,12);
}
if ( SampleLine2 == PartLine )
{
Rev = FullLine.substr(15,3);
}
}
myfile1.close();
PartChange();
myfile2 << "asset /b " +BeginLine + PartNum + EndLine + "-" + Rev + " /f" << endl;
myfile2.close();
}
else cout << "Unable to open file";
}
else cout << "Unable to open file";
return 0;
}
Thanks