Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] error in adding cpp library to c project in keil

Status
Not open for further replies.

dizgah

Member level 5
Joined
Nov 8, 2009
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
iran-8par
Activity points
2,049
hi every one
im trying to develop a c project in keil ,know i need to add a cpp library file to project & it shows error,i think it is because project uses c compiler & it cant compile cpp libraries,but i dosent have any suggestion to what i must do !
keils error :
error: #20: identifier "class" is undefined
library consist of a lib_XX.h file (for example ) & lib_XX.cpp file
& like any other libraries i include .h file in main.c (my main program file )
#include "lib_XX.h"
-----
libraries dosent have any problem & i used them in keil cpp project before.
is there any suggestion ?
Mary christmas
Mahmoud
 

Yes, classes don't exist in C. You should be able to compile the whole project using a C++ compiler instead.
 
  • Like
Reactions: dizgah

    dizgah

    Points: 2
    Helpful Answer Positive Rating
actually im trying to convert my last project to cpp but there is a problem too:
im using https://en.radzio.dxp.pl/ks0108/ library to initial ks0108 GLCD with stm32f103 , every thing is ok except GLCD_Bitmap function
Code:
void GLCD_Bitmap( const unsigned char * bmp, unsigned char x, unsigned char y, unsigned char dx, unsigned char dy)
{
unsigned char i, j;
for(j = 0; j < dy / 8; j++)
  {
  GLCD_GoTo(x,y + j);
  for(i = 0; i < dx; i++) 
    GLCD_WriteData(GLCD_ReadByteFromROMMemory(bmp++));
  }
}
it draws a stored image,GLCD_WriteData function dosent have any problem because other functions used it correctly.
this function declared on ks0108.c file
when there is not declaration of this function on ks0108.h (
void GLCD_Bitmap( const unsigned char * bmp, unsigned char x, unsigned char y, unsigned char dx, unsigned char dy);
) compiler show this warning but program run correct .
warning: #223-D: function "GLCD_Bitmap" declared implicitly
but when i add that declaration to ks0108.h it show error & dosent compile:
error: #167: argument of type "const unsigned char (*)[1024]" is incompatible with parameter of type "const unsigned char *"
im completely mixed up,
i attached completed project if any one help me or give me a other example of ks0108 with stm32
 

Attachments

  • ks0108.zip
    4 MB · Views: 55

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top