1

when I try to compile the openmp cpp file from this website, I got a link warning saying that the openmp flag is ignored.

LNK4044:unrecognized option '/openmp'; ignored

I have already added these code to the pro. file

QMAKE_CXXFLAGS+= -openmp
QMAKE_LFLAGS +=  -openmp

or

QMAKE_CXXFLAGS += -fopenmp
LIBS += -fopenmp

as suggeted by some other stack overflow questions.But that does not solve the problem. Can any one help me to solve this problem? I am using the qt creator 3.1.2 with msvc2013 compiler on windows 7.

Iching Chang
  • 638
  • 1
  • 7
  • 17

1 Answers1

2

MSVC's linker does not need or accept the /openmp option. You only need that option for GCC (in which case the option is -fopenmp). Although I use CMake now with QtCreator instead of qmake here is a sample from the last qmake file I use.

msvc {
  QMAKE_CXXFLAGS += -openmp -arch:AVX -D "_CRT_SECURE_NO_WARNINGS"
  QMAKE_CXXFLAGS_RELEASE *= -O2
}

gcc {
  QMAKE_CXXFLAGS += -fopenmp -mavx -fabi-version=0 -ffast-math
  QMAKE_LFLAGS += -fopenmp
  QMAKE_CXXFLAGS_RELEASE *= -O3
}
Z boson
  • 32,619
  • 11
  • 123
  • 226
  • thank you, I think I overstated the question before, the openmp is actually running, there is only a warning of the linker. Now I solve the problem by taking your advice – Iching Chang Aug 18 '14 at 11:42