S
S
sddvxd2019-01-01 09:29:48
C++ / C#
sddvxd, 2019-01-01 09:29:48

Why does the link error occur in this case?

Good afternoon!
You have to compile your project from the command line with g++

g++ main.cpp  -lglfw3 -lgdi32 -lopengl32 -lglew32 -lopengl32

This command completes successfully. But in the IDE where I'm trying to build it (QtCreator) the following error pops up:
'memset' was not declared in this scope
 inline void PropVariantInit (PROPVARIANT *pvar) { memset (pvar, 0, sizeof (PROPVARIANT)); }

and the qmake file is configured like this:
TARGET = learning
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS

CONFIG += c++11

LIBS += -lglfw3 -lgdi32 -lopengl32 -lglew32 -lopengl32

SOURCES += \
        main.cpp

The binaries of the libraries are listed in the same way, but the linker does not find the function above when trying to build the project in the IDE. Please tell me why this might be

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2019-01-01
@jcmvbkbc

Why does the link error occur in this case?
This is a compilation error, not a linking error. Because there isn't enough#include <cstring>

V
Vitaly, 2019-01-01
@vt4a2h

See what Makefile qmake generates. Extra paths or flags from the spec file may be added there.
Check if g++ is actually used when compiling and linking, and not, say, gcc (this can be seen in the Compile output window).
Check if the cstring file is included wherever needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question