0
votes

lib1 has two files

math.h

inline void hello();

and math.cpp

#include <iostream>
#include "math.h"

void hello() {
    std::cout << "hello from math";
}

lib2 is a c++ 2a module lib:

export module Bar;

import "math.h";
import std.core;

export namespace bar {
    void BarFunc() { 
        hello();
    }
}

visual studio 16.8.0 compiler will say:(Bar.ixx.obj) : error LNK2001: unresolved external symbol "void __cdecl hello(void)" (?hello@@YAXXZ)

2

2 Answers

0
votes

math.h

inline void hello();

to

void hello();

works.

-1
votes

Given the current information, I am afraid that I cannot determine the cause of the problem. So, I suggest that you could use DUMPBIN to help you find the cause.

The /EXPORTS and /SYMBOLS options of the DUMPBIN command-line tool are useful here. They can help you discover which symbols are defined in your .dll and object or library files. You can use the symbols list to verify that the exported decorated names match the decorated names the linker searches for.

In some cases, the linker can only report the decorated name for a symbol. You can use the UNDNAME command-line tool to get the undecorated form of a decorated name.