79606516

Date: 2025-05-05 07:54:34
Score: 3
Natty:
Report link

One more question: exporting a non class function fails to

error C7619: cannot export 'nonClassFunc1' as module partition 'Internal'
does not contribute to the exported interface of module unit 'ModTest'

firstFile.cpp

export module ModTest:One;
 
export class FirstClass {
public:
    FirstClass();
    int firstClassFunc();
};
 
export int nonClassFunc1();             // DOES NOT WORK
export int nonClassFunc2(){ return 9; } // WORKS

firstFile_impl.cpp

module ModTest:Internal;
import :One;  // <========== Import `FirstClass`
import :Two;  // <========== Import `SecondClass`
 
int FirstClass::firstClassFunc() { return 8; }
 
FirstClass::FirstClass()
{
    SecondClass sec(this);
}
 
int nonClassFunc1() { return 9; }       // --> C7619

What is wrong here?
Thank you!

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: mael15