error LNK2001: unresolved external symbol with CMake and directories C and C++

1.4k views Asked by At

I'm new to CMake and also new to compiling mixed source, I have received the following errors while trying to compile using CMake and Visual Studio 14.0

(Link target) -> main.obj : error LNK2001: unresolved external symbol ethash_get_cachesize main.obj : error LNK2001: unresolved external symbol ethash_get_datasize

The layout of my project is like this:

I have ethash_get_cachesize and ethash_get_datasize defined in internal.c in a directory ethminer/libethash/ these are C source. im sure that the CMake file that came with this set of sources is ok as the project has compiled before without issue, it has only given me LINK problems after i have added the following:

I have another directory /ethminer/dag/ with a C++ source "dag.cpp" and "dag.h" these are both C++ files. and the CMake file.

set(SOURCES
    DAG.h DAG.cpp
)

include_directories(BEFORE ..)

link_directories(BEFORE ..)

the C++ source file "dag.cpp" includes #include <libethash/internal.h>

however I fear that I am missing something to tell CMake or Visual Studio to find the files it needs from the directory containing "internal.c"

any help would be much appreciated

0

There are 0 answers