Expected expression in LFO.cpp | Compiler Errors & Warnings | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Expected expression in LFO.cpp
May 5, 2015 - 8:04 pm
Member Since: March 24, 2015
Forum Posts: 8
sp_UserOfflineSmall Offline

Hey all,

I'm working my way through the synth book and was doing the first setup of LFO.cpp. I'm not sure where I went wrong in putting together the doOscillate() function but I get an error message that VS "Expected an expression"

double CLFO::doOscillate()
inline double doOscillate(double* pQuadPhaseOutput = NULL) // the "inline" is where the error is being called


now if I add virtual to the call:

double CLFO::doOscillate()
inline virtual double doOscillate(double* pQuadPhaseOutput = NULL)

the expected expression error is resolved, but then virtual will raise an "invalid specifier outside a class declaration" error

I'm not sure what's wrong, but I believe I did everything else right (creating the LFO class, using COscillator as a base, including the appropriate headers, etc...)

May 5, 2015 - 9:02 pm
Member Since: January 29, 2017
Forum Posts: 689
sp_UserOfflineSmall Offline

I'm not sure what you are trying to do here, but both syntaxes are wrong.

I think you have doOscillate() defined in the .h file

// in the .h file somewhere
inline double doOscillate()


Whenever you define a function implementation (with or without the inline specifier, and with or without the virtual specifier) inside the .h file, there is no implementation in the .cpp file. I would have expected a "this function already has a body" error. So, you should't be implementing the function in the .cpp file if you already have it in the .h file.

If on the other hand you are trying to call the base class, you would write:

double CLFO::doOscillate()

The doOscillate(), doFilter() and other CPU intensive functions are implemented in the .h file and declared as inline to force the compiler to place the chunk of code inline without jumps, which is less efficient in terms of DLL size, but (theoretically at least) more efficient for CPU usage since the jumps are removed.

- Will

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 1

Members: 768

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 842

Posts: 3347

Moderators: W Pirkle: 689