Thread: Error during compiling

  1. #1
    Registered User
    Join Date
    Jun 2010

    Error during compiling

    I have following code in file php_mysqlnd.c
    #if defined(PHP_DEBUG)
    static PHP_RSHUTDOWN_FUNCTION(mysqlnd)
    	MYSQLND_DEBUG *dbg = MYSQLND_G(dbg);
    	if (dbg) {
    		MYSQLND_G(dbg) = NULL;
    	return SUCCESS;
    /* }}} */
    I am getting following error

    ext\mysqlnd\php_mysqlnd.c(256) : error C2106: '=' : left operand must be l-value

    on code line
    		MYSQLND_G(dbg) = NULL;
    Please anyone guide me

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Is that line even supposed to be there? Perhaps you can remove it safely.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    Quote Originally Posted by altaf View Post
    ext\mysqlnd\php_mysqlnd.c(256) : error C2106: '=' : left operand must be l-value
    What this means is that the left side must be something that can be assigned to. I think the only way that could work for this:
    would be if that were a macro like this:
    #define MYSQLND_G(a)
    So if dgb were a struct with a member "id" you could assign to it this way.

    The other clue here:
    	MYSQLND_DEBUG *dbg = MYSQLND_G(dbg);
    Makes it clear that what MYSQLND_G actually does is return an address, eg:
    #define MYSQLND_G(a) &a
    You cannot assign NULL to an address. This all could work if it returned a number equivalent to an address, but it's still beyond me why you'd want to then assign that NULL.

    Like laserlight says, I'd try leaving that line out. The variable names here imply this is for development/debugging -- it probably is not normally used.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    May 2010
    Can't you grep where this look-like-macro is defined?

  5. #5
    Registered User
    Join Date
    Oct 2008
    MK27: You seem to disagree with yourself. It DOES make sense for MYSQLND_G to return a pointer AND be an l-value. You gave the example yourself:
    #define MYSQLND_G(a)
    Where is a pointer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling errors and using Cmake Set Policy
    By eligor in forum Linux Programming
    Replies: 2
    Last Post: 01-25-2010, 01:43 PM
  2. Compiling Issues
    By pc_doctor in forum C Programming
    Replies: 3
    Last Post: 11-30-2007, 10:00 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  5. Compiling in Unix vs Visual C++
    By stimpyzu in forum C++ Programming
    Replies: 2
    Last Post: 09-30-2002, 06:41 AM