Code failing to create file
I am trying to build some third party code that is an compiler for the old MC6809 CPU.
Code:
/* Create an asm file that will receive the assembly language code:
*/
if (numErrors == 0)
{
if (verbose)
{
cout << "Assembly language filename: " << asmFilename << "\n";
cout << flush;
}
ofstream asmFile(asmFilename.c_str(), ios::out);
if (!asmFile)
{
int e = errno;
cout << PACKAGE << fatalErrorPrefix << "failed to create assembler file " << asmFilename
<< ": " << strerror(e) << endl;
return EXIT_FAILURE;
}
if (!asmText.writeFile(asmFile))
{
cout << PACKAGE << fatalErrorPrefix << "failed to write output assembly file " << asmFilename << endl;
return EXIT_FAILURE;
}
asmFile.close();
if (!asmFile)
{
cout << PACKAGE << fatalErrorPrefix << "failed to close output assembly file " << asmFilename << endl;
return EXIT_FAILURE;
}
}
if (verbose)
cout << numErrors << " error(s)"
<< ", " << numWarnings << " warning(s)." << endl;
The output from this section of code and the sub-program it calls is
Code:
Assembly language filename: atol.s
0 error(s), 0 warning(s).
Assembler command: lwasm -fobj --pragma=forwardrefmax -D_COCO_BASIC_ --output='atol.o' 'atol.s'
Cannot open file ''atol.s'': No such file or directory
Exit code from assembler command: 1
Any suggestion of code to add to trace the problem; it is a large program built using configure/make so using debugger would like be beyond me.
Edit: I have search the file atol.s does not exist.
Edit2: I am thinking this test "if (!asmFile)" is not correct.
Edit3: Link to full file cmoc/main.cpp at master * stahta01/cmoc * GitHub
The snippet posted is around line 1250.
Edit4: I am porting the code to work under Windows 10; it is designed for Linux; but, has worked in the past under windows with, unknown to me, minor changes.
Tim S.