Need advices on solving compile time errors.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Need advices on solving compile time errors.

  1. #1
    Join Date
    Dec 2010
    Posts
    584

    Need advices on solving compile time errors.

    Error 1 error C2121: '#': invalid character: may be the result of macro expansion e: \ dosbox_ykhwong \ src \ dos \ dos_network2.h 114 1 dosbox
    Error 2 error C3861: 'L': Can not find identifier e: \ dosbox_ykhwong \ src \ dos \ dos_network2.h 114 1 dosbox

    Code:
     extern "C" int _nhandle;
     bool	Network_CloseFile(Bit16u entry)
    {
    		Bit32u		handle=RealHandle(entry);
    		int _Expr_val=!!((handle >= 0 && (unsigned)handle < (unsigned)_nhandle));
    		_ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#(handle >= 0 && (unsigned)handle < (unsigned)_nhandle)) );         <<<<<<<<<<<< the pound sign generates this error
    		if ( !( _Expr_val ) ) {
    			_doserrno = 0L;
    			errno = EBADF;
    			dos.errorcode=(Bit16u)_doserrno;
    			return false;
    		}
    
    		if(close(handle)==0)
    		{
    			NetworkHandleList[entry]=0;
    
    			DOS_PSP		psp(dos.psp());
    			psp.SetFileHandle(entry,0xff);
    
    			return	true;
    		}
    		else
    		{
    			dos.errorcode=(Bit16u)_doserrno;
    			return	false;
    		}
    }//bool	Network_CloseFile(Bit16u entry)
    Any help would be greatly appreciated!
    Thanks
    Jack

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    Re: Need advices on solving compile time errors.

    Quote Originally Posted by lucky6969b View Post
    Code:
     extern "C" int _nhandle;
     bool	Network_CloseFile(Bit16u entry)
    {
    		Bit32u		handle=RealHandle(entry);
    		int _Expr_val=!!((handle >= 0 && (unsigned)handle < (unsigned)_nhandle));
    		_ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#(handle >= 0 && (unsigned)handle < (unsigned)_nhandle)) );         <<<<<<<<<<<< the pound sign generates this error
    		if ( !( _Expr_val ) ) {
    			_doserrno = 0L;
    			errno = EBADF;
    			dos.errorcode=(Bit16u)_doserrno;
    			return false;
    		}
    
    		if(close(handle)==0)
    		{
    			NetworkHandleList[entry]=0;
    
    			DOS_PSP		psp(dos.psp());
    			psp.SetFileHandle(entry,0xff);
    
    			return	true;
    		}
    		else
    		{
    			dos.errorcode=(Bit16u)_doserrno;
    			return	false;
    		}
    }//bool	Network_CloseFile(Bit16u entry)
    And what is the bit in red for?
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Dec 2010
    Posts
    584

    Re: Need advices on solving compile time errors.

    Thanks eri, I asked back the original author, he said it wasn't needed anymore, so I just don't bother fiddling with it now.
    Let's go to another question, (should I open a new thread?)
    is that when I enclose certain things in a namespace say
    Code:
     namespace Util {
    std::string compress(const std::string& input) { //throw (SaveState::Error)
    	if (input.empty())
    		return input;
    
    	const uLong bufferSize = ::compressBound(input.size());
    
    	std::string output;
    	output.resize(bufferSize);
    Error 1 error C2039: members of the 'compressBound': '`global the namespace'' e: \ the dosbox_ykhwong \ src \ save_state.cpp 66 1 dosbox
    Error 2 error C3861: the 'compressBound': identifier not found e: \ dosbox_ykhwong \ src \ save_state.cpp 66 1 dosbox

    the ::compressBound is not recognized. Is it supposed to be within Util or the global namespace.
    If you have already used that before, it is called the zlib, it is also very common in IT industry. Just some compression stuff.
    I am compiling the ykhwong build of dosbox.
    Thanks
    Jack

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    Re: Need advices on solving compile time errors.

    Quote Originally Posted by lucky6969b View Post
    Thanks eri, I asked back the original author, he said it wasn't needed anymore, so I just don't bother fiddling with it now.
    I can hardly imagine that would ever have compiled under any version of the C++ or C standard, except perhaps it's some really funky and hard to comprehend "pattern" defining a macro within a macro expansion (what I somehow doubt is possile at all). And all that would heavily depend on the definition of the _CRT_WIDE macro which no-one around here except you may know by now.

    As to the rest of your post: No-one can tell anything from that incomplete code snippet of yours. Not only that super short code snippets like this hardly ever are compilable in general, yours also suffers from unbalanced braces.

    And no, I, myself, didn't ever use zlib.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,011

    Re: Need advices on solving compile time errors.

    Quote Originally Posted by lucky6969b View Post
    the ::compressBound is not recognized. Is it supposed to be within Util or the global namespace.
    If you write ::compressBound, it must be declared in the global namespace. If it is declared either in namespace Util or in the global namespace, then drop the colons.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center