What extra things to do when c based file to add in qt and when we want to add QString class in it ?
-
Actually main problem is i want to use QString in c file .
i have added NFC interface related set of files written in in c in qt. to support nfc interface i have added that. Now i want to use QString class in that file. then how to use it ?
because when i add below code in same file than it give lots of error:
" error: unknown type name 'class' class QString"My added header file is
#include <QString>
& written code is :
static char filename[20]; static int adapter_nr = 2; QString status = QString("/dev/i2c-%1").arg(adapter_nr);
-
then that way is not possible.
You can incorporate c files/code in a c++ project or you can include a c++ library(precompiled) in a c project but you can't s imply include c++ code into a c project.
-
Actually main problem is i want to use QString in c file .
i have added NFC interface related set of files written in in c in qt. to support nfc interface i have added that. Now i want to use QString class in that file. then how to use it ?
because when i add below code in same file than it give lots of error:
" error: unknown type name 'class' class QString"My added header file is
#include <QString>
& written code is :
static char filename[20]; static int adapter_nr = 2; QString status = QString("/dev/i2c-%1").arg(adapter_nr);
@Qt-embedded-developer said in What extra things to do when c based file to add in qt and when we want to add QString class in it ?:
i want to use QString in c file
Then it needs to be C++ file.
What is file extension? .c or .cpp? -
@Qt-embedded-developer said in What extra things to do when c based file to add in qt and when we want to add QString class in it ?:
i want to use QString in c file
Then it needs to be C++ file.
What is file extension? .c or .cpp?@jsulm File extension is '.c'
-
@jsulm File extension is '.c'
@Qt-embedded-developer Change to .cpp
-
then that way is not possible.
You can incorporate c files/code in a c++ project or you can include a c++ library(precompiled) in a c project but you can't s imply include c++ code into a c project.