module;
#include <iostream>
export module modultest;
export class Test{
public:
Test(){}
void print(){
}
};
I want to create a print
function using cout
, which I need <iostream>
for, but if I include iostream
I get multiple errors, for example:
error: redefinition of 'void operator delete(void*, void*)'
180 | inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
I'm using g++ compiler in VSCode.
Per cppreference.com:
Importing modules and header units
So, try replacing
#include <iostream>
withimport <iostream>;
instead.