Skip to main content
T J
Senior III
September 7, 2018
Question

Using the inline compiling macro ?

  • September 7, 2018
  • 13 replies
  • 1965 views

I have an LCD is on an 8080 16bit FMC interface with A0 register select.

I can read the status correctly here:

#define LCD1_DEVICE_ADDR (uint32_t)0x60000000
#define LCD1_DEVICE_DATA (uint32_t)0x60000001
 
 uint16_t *pLcdRStatusWAddress = LCD1_DEVICE_ADDR;
 readLcdStatus = *pLcdRStatusWAddress;
 
 

All of these snippets are within one file,

//this compiles:
 
inline lcdRegDataWrite(uint8_t reg, uint8_t data) {
 *(__IO uint16_t*)LCD1_DEVICE_ADDR = reg; 
 *(__IO uint16_t*)LCD1_DEVICE_DATA = data; 
} 
 
//but this doesn't find it
 
 lcdRegDataWrite( 1 , 8);
 
>>> undefined reference to `lcdRegDataWrite'
 
 

    This topic has been closed for replies.

    13 replies

    T J
    T JAuthor
    Senior III
    September 19, 2018

    are you saying its not a syntax error, but a compiler issue ?

    waclawek.jan
    Super User
    September 19, 2018

    The compiler should resolve the internal links within one file, i.e. if the usage is after definition in the same file, it should be resolved within the compiler and the linker should never know about it.

    Now I noticed you compile using gcc and link using g++; I don't say this may cause the problem but I found it strange. I don't use C++ so can't comment.

    JW

    T J
    T JAuthor
    Senior III
    September 19, 2018

    I use Visual Studio, it is an automated make.

    I don't purposely run G++ C++ or anything in particular.

    thanks for the support.