Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_28-Nov-17 4:09
Vaclav_28-Nov-17 4:09 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Richard MacCutchan28-Nov-17 4:25
mveRichard MacCutchan28-Nov-17 4:25 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_28-Nov-17 7:07
Vaclav_28-Nov-17 7:07 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Richard MacCutchan28-Nov-17 8:37
mveRichard MacCutchan28-Nov-17 8:37 
AnswerRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Jochen Arndt28-Nov-17 4:54
professionalJochen Arndt28-Nov-17 4:54 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_28-Nov-17 7:46
Vaclav_28-Nov-17 7:46 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Jochen Arndt28-Nov-17 8:39
professionalJochen Arndt28-Nov-17 8:39 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
David Crow28-Nov-17 8:14
David Crow28-Nov-17 8:14 
I took your code and plugged it into Visual Studio with the following changes:

***** stdafx.h ***** (I turned off pre-compiled headers so that it would more closely mimic GCC)

#define MY_DEBUG

#include <iostream>

#include <math.h> // rint round up math
#include <stdio.h>
#include <stdlib.h>

#include <fcntl.h>
//#include <sys/shm.h>
#include <sys/stat.h>
//#include <sys/mman.h>
//#include <unistd.h>
#include <math.h> // rint round up math
//#include "/usr/local/include/wiringPiSPI.h"

#include <math.h> // rint round up math libraray lm

using namespace std;


***** hf_vna_cross_cpp.cpp *****

#include "stdafx.h"

//#include "flash_DTR.h" // flash DTR via USB port
/* CCC temp out
#include "AD9851.h" // AD9851 via SPI / I2C
#include "LCD_SPI.h" // LCD via SPI
*/

//#include "MY_wiringPi.h" // GPIO for RPi

//#include "LCD.h" // TEST CLASS
//#include "TESTCLASS.h" //
//#include "LCDSPI.h" // NO SPACE

#include "TESTCLASS1.h"

int main() {
cout << "NEW *** COPY 2 TEST output HF_VNA_CROSS_CPP CPP Managed project" << endl; // prints CPP Managed project

//temp bypass CCC
// class test block start
{
#ifdef MY_DEBUG
cout << " process code block START"<< endl;
cout << "*** TRACE file " << __FILE__<< endl;
cout <<" function " <<__FUNCTION__<<endl;
cout << " line " << __LINE__<< endl;
#endif
//LCD__SPI lcd; // double space INSTATIATE CLASS
//lcd.TestFunction();
TEST_CLASS_1 test_class;
test_class.TestFunction();

}
// class test block end
// */
return 43;

#ifdef MY_DEBUG
cout << "*** TRACE file " << __FILE__<<" line " <<__LINE__<< " function "<< __FUNCTION__ << endl;
//return 42;
#endif


//flash();
// process code block START
{
#ifdef MY_DEBUG
cout << " process code block START"<< endl;
cout << "*** TRACE file " << __FILE__<< endl;
cout <<" function " <<__FUNCTION__<<endl;
cout << " line " << __LINE__<< endl;
#endif
// process code block END
#ifdef MY_DEBUG
cout << " process code block END"<< endl;
cout << "*** TRACE file " << __FILE__<< endl;
cout <<" function " <<__FUNCTION__<<endl;
cout << " line " << __LINE__<< endl;
#endif
}

/* temp bypass CCC
// class test block start
{
LCD lcd; // INSTATIATE CLASS

//lcd.TestFunction(10);
}
// class test block end
*/
}


***** testclass1.h *****

#ifndef TESTCLASS1_H_
#define TESTCLASS1_H_

#include "stdafx.h"

class TEST_CLASS_1 
{
    public:
        TEST_CLASS_1(){}
        virtual ~TEST_CLASS_1(){}

        int TestFunction(void){return 1;}
};

#endif 


The only change I had to make was implementing the three methods in the TEST_CLASS_1 class. It all compiled fine.

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles


GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_28-Nov-17 11:26
Vaclav_28-Nov-17 11:26 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
David Crow28-Nov-17 14:03
David Crow28-Nov-17 14:03 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Richard MacCutchan28-Nov-17 21:40
mveRichard MacCutchan28-Nov-17 21:40 
AnswerRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_28-Nov-17 12:25
Vaclav_28-Nov-17 12:25 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Jochen Arndt28-Nov-17 21:28
professionalJochen Arndt28-Nov-17 21:28 
GeneralRe: C++ cout in header file error - ‘cout’ was not declared in this scope Pin
Vaclav_29-Nov-17 17:36
Vaclav_29-Nov-17 17:36 
Questionem_setwordbreakproc in MFC Pin
ForNow26-Nov-17 14:05
ForNow26-Nov-17 14:05 
AnswerRe: em_setwordbreakproc in MFC Pin
Richard MacCutchan26-Nov-17 21:37
mveRichard MacCutchan26-Nov-17 21:37 
GeneralRe: em_setwordbreakproc in MFC Pin
ForNow27-Nov-17 1:52
ForNow27-Nov-17 1:52 
GeneralRe: em_setwordbreakproc in MFC Pin
Richard MacCutchan27-Nov-17 6:23
mveRichard MacCutchan27-Nov-17 6:23 
AnswerRe: em_setwordbreakproc in MFC Pin
Jochen Arndt26-Nov-17 21:46
professionalJochen Arndt26-Nov-17 21:46 
GeneralRe: em_setwordbreakproc in MFC Pin
ForNow27-Nov-17 1:50
ForNow27-Nov-17 1:50 
GeneralRe: em_setwordbreakproc in MFC Pin
Jochen Arndt27-Nov-17 2:28
professionalJochen Arndt27-Nov-17 2:28 
QuestionType Conversion error while running C++ code in ubuntu Pin
User 1350945025-Nov-17 18:18
professionalUser 1350945025-Nov-17 18:18 
AnswerRe: Type Conversion error while running C++ code in ubuntu Pin
Rick York25-Nov-17 19:48
mveRick York25-Nov-17 19:48 
PraiseRe: Type Conversion error while running C++ code in ubuntu Pin
CPallini26-Nov-17 7:46
mveCPallini26-Nov-17 7:46 
AnswerRe: Type Conversion error while running C++ code in ubuntu Pin
jeronimax26-Nov-17 13:16
jeronimax26-Nov-17 13:16 

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.