Click here to Skip to main content
14,237,525 members

C / C++ / MFC

 
AnswerRe: Are there programmers that are currently using machine code and Assembly? Pin
HS_C_Student13-Jan-19 10:56
memberHS_C_Student13-Jan-19 10:56 
GeneralRe: Are there programmers that are currently using machine code and Assembly? Pin
HS_C_Student13-Jan-19 11:11
memberHS_C_Student13-Jan-19 11:11 
GeneralRe: Are there programmers that are currently using machine code and Assembly? Pin
Quantum Robin13-Jan-19 16:39
memberQuantum Robin13-Jan-19 16:39 
AnswerRe: Are there programmers that are currently using machine code and Assembly? Pin
leon de boer13-Jan-19 16:34
memberleon de boer13-Jan-19 16:34 
AnswerRe: Are there programmers that are currently using machine code and Assembly? Pin
CPallini13-Jan-19 21:26
mveCPallini13-Jan-19 21:26 
AnswerRe: Are there programmers that are currently using machine code and Assembly? Pin
Joe Woodbury14-Jan-19 6:25
professionalJoe Woodbury14-Jan-19 6:25 
JokeRe: Are there programmers that are currently using machine code and Assembly? Pin
Quantum Robin14-Jan-19 13:52
memberQuantum Robin14-Jan-19 13:52 
Questionerror: expected identifier before string constant Pin
Vaclav_13-Jan-19 6:28
memberVaclav_13-Jan-19 6:28 
I hope I can explain this problem.

I can make an instance of a class in my main()


CLASS_I2CIO   i2c_ads1115(DEVICE_I2C,ADDRESS_ADS);


no problema.

But if I add same code as class variable - I need an access to the class form main() - I get the following error.

class C_VNA {
public:
	C_VNA();
	virtual ~C_VNA();

	C_Utility utility;
	CLASS_LCM1602 i2c;	// default constructor x,x,x,x);
	CIOCTLGPIO gpio;    // GPIo
	C_IOCTL_SPI spi;    // temporary not coded
	C_DDS_60 dds;       // frequency
	C_AD8302_Detector det;
    C_ADS1115 ads;
    CLASS_I2CIO   i2c_ioctl;       // genric i2c using ioctl

error here 
    CLASS_I2CIO   i2c_ads1115_test(DEVICE_I2C,ADDRESS_ADS);
error here 
};



Partial compiler output

Compiler executable checksum: 606522cdd68a1ba2fd9e2930e9d38d0d
In file included from ../src/MODULES/M_VNA/CVNA.cpp:8:0:
../src/MODULES/M_VNA/CVNA.h:28:20: error: expected identifier before string constant
 #define DEVICE_I2C "dev/i2c-1"
                    ^
../src/MODULES/M_VNA/CVNA.h:60:36: note: in expansion of macro ‘DEVICE_I2C’
src/MODULES/M_VNA/subdir.mk:18: recipe for target 'src/MODULES/M_VNA/CVNA.o' failed
     CLASS_I2CIO   i2c_ads1115_test(DEVICE_I2C,ADDRESS_ADS);
                                    ^
../src/MODULES/M_VNA/CVNA.h:28:20: error: expected ‘,’ or ‘...’ before string constant
 #define DEVICE_I2C "dev/i2c-1"
                    ^
../src/MODULES/M_VNA/CVNA.h:60:36: note: in expansion of macro ‘DEVICE_I2C’
     CLASS_I2CIO   i2c_ads1115_test(DEVICE_I2C,ADDRESS_ADS);
                                    ^
make: *** [src/MODULES/M_VNA/CVNA.o] Error 1


There is nothing special about #defines

// devices
#define DEVICE_SPI "dev/spidev0.0"
#define DEVICE_I2C "dev/i2c-1"

// define i2c addresses
#define ADDRESS_HITACHI 0x27
#define ADDRESS_ADS 0x48



The error "points " to #define which is redefined in this class - temporary for test purposes.
I did look thru similar problems and they all indicate the #define is NOT the issue, however I am unable to figure this out and correct it.
Any help would be appreciated.
Cheers
AnswerRe: error: expected identifier before string constant Pin
Richard MacCutchan13-Jan-19 6:49
protectorRichard MacCutchan13-Jan-19 6:49 
GeneralRe: error: expected identifier before string constant Pin
Vaclav_13-Jan-19 7:21
memberVaclav_13-Jan-19 7:21 
GeneralRe: error: expected identifier before string constant Pin
Richard MacCutchan13-Jan-19 22:29
protectorRichard MacCutchan13-Jan-19 22:29 
GeneralRe: error: expected identifier before string constant Pin
Stefan_Lang16-Jan-19 23:28
memberStefan_Lang16-Jan-19 23:28 
GeneralRe: error: expected identifier before string constant Pin
Richard MacCutchan16-Jan-19 23:56
protectorRichard MacCutchan16-Jan-19 23:56 
GeneralRe: error: expected identifier before string constant Pin
Stefan_Lang17-Jan-19 1:30
memberStefan_Lang17-Jan-19 1:30 
AnswerRe: error: expected identifier before string constant Pin
k505413-Jan-19 8:29
memberk505413-Jan-19 8:29 
AnswerRe: error: expected identifier before string constant Pin
Graham Breach13-Jan-19 23:21
memberGraham Breach13-Jan-19 23:21 
GeneralRe: error: expected identifier before string constant Pin
Vaclav_14-Jan-19 3:33
memberVaclav_14-Jan-19 3:33 
GeneralRe: error: expected identifier before string constant Pin
Graham Breach14-Jan-19 4:33
memberGraham Breach14-Jan-19 4:33 
AnswerRe: error: expected identifier before string constant Pin
Stefan_Lang16-Jan-19 22:38
memberStefan_Lang16-Jan-19 22:38 
GeneralRe: error: expected identifier before string constant Pin
Vaclav_19-Jan-19 18:31
memberVaclav_19-Jan-19 18:31 
Question(C) Robust code Should an unsigned int array index be tested for "< 0" Pin
HS_C_Student11-Jan-19 3:27
memberHS_C_Student11-Jan-19 3:27 
AnswerRe: (C) Robust code Should an unsigned int array index be tested for "< 0" Pin
CPallini11-Jan-19 5:25
mveCPallini11-Jan-19 5:25 
GeneralRe: (C) Robust code Should an unsigned int array index be tested for "< 0" Pin
Bram van Kampen12-Jan-19 14:29
memberBram van Kampen12-Jan-19 14:29 
SuggestionRe: (C) Robust code Should an unsigned int array index be tested for "< 0" Pin
David Crow11-Jan-19 5:40
memberDavid Crow11-Jan-19 5:40 
GeneralRe: (C) Robust code Should an unsigned int array index be tested for "< 0" Pin
HS_C_Student11-Jan-19 7:17
memberHS_C_Student11-Jan-19 7:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.