Error with "using namespace …"

Sysprogs forums Forums VisualGDB Error with "using namespace …"

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27782
    GeneM
    Participant

    I’m still very much a beginner with VisualGDB but I have successfully built a lot of small programs while I’m learning.  Until now.  I’m building a new VisulGDB embedded program starting with the STM32 CubeMX sample “UART_TwoBoards_ComDMA”  It is supposed to use the “C++17 with GNU extensions” language standard.  But when I try to add a “using namespace xyz” like this, I get a “unknown type name ‘using'” error. I’ve built several programs from this sample in the past and they all work with the using namespace statement but I can’t see what I did or didn’t do in this case.  Any ideas?

    Thanks

    #include "main.h"
    #include "qpcpp.h"
    #include "bsp.hpp"
    #include <iostream> // for cout/cerr
    #include <cstdlib> // for exit()

    using namespace QP;
    using namespace std;

    #ifdef __cplusplus
    extern "C"
    #endif

    UART_HandleTypeDef UartHandle;

    // Buffers for RX and TX
    uint8_t TXBuffer[] = "$PUBX,00*33\r\n";
    uint8_t RXBuffer[256];

    static void SystemClock_Config(void);
    static void Error_Handler(void);
    static uint16_t Buffercmp(uint8_t* pBuffer1, uint8_t* pBuffer2, uint16_t BufferLength);

    int main(void)
    { // code here

    }

     

    #27783
    GeneM
    Participant

    As happens so often, I figured out the solution 30 seconds after posting this question.  The sample file used main.c and I needed to rename is main.cpp.  Sorry for the distraction.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.