[SOLVED]different compile behavior between codelite and cmd

General questions regarding the usage of CodeLite
coot
CodeLite Enthusiast
Posts: 20
Joined: Thu Jun 15, 2017 1:41 pm
Genuine User: Yes
IDE Question: c++
Contact:

[SOLVED]different compile behavior between codelite and cmd

Post by coot »

When trying to link gtest library, the codelite compile failed but the command line compile successfully.
the cmakelists.txt generated by codelite:

Code: Select all

add_executable(TEST_codelite ${RC_SRCS} ${CXX_SRCS} ${C_SRCS})
target_link_libraries(TEST_codelite ${LINK_OPTIONS})

target_link_libraries(TEST_codelite
    ${WORKSPACE_PATH}gtest/lib/libgtest.a
)
make in command line:

Code: Select all

cmake -G "MinGW Makefiles" ../
mingw32-make
the compile result in codelite

Code: Select all

C:\Windows\system32\cmd.exe /C cd D:\Projects\TEST_codelite\cmake-build-Debug\TEST_codelite && D:/Tools/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e
[ 33%] Linking CXX executable ..\output\TEST_codelite.exe
CMakeFiles\TEST_codelite.dir/objects.a(TestFramework.cpp.obj): In function `__static_initialization_and_destruction_0':
D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:54: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:97: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:141: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:175: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:212: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
CMakeFiles\TEST_codelite.dir/objects.a(TestFramework.cpp.obj):D:/Projects/TEST_codelite/CTest/src/TestFramework.cpp:257: more undefined references to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)' follow
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [../output/TEST_codelite.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/TEST_codelite.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
CMakeFiles\TEST_codelite.dir\build.make:125: recipe for target '../output/TEST_codelite.exe' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/TEST_codelite.dir/all' failed
Makefile:82: recipe for target 'all' failed
====6 errors, 0 warnings====
the compile result in command line:

Code: Select all

D:\Projects\TEST_codelite\build>cmake -G "MinGW Makefiles" ../
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Projects/TEST_codelite/build

D:\Projects\TEST_codelite\build>mingw32-make
[ 33%] Linking CXX executable ..\cmake-build-Debug\output\TEST_codelite.exe
[100%] Built target TEST_codelite
Last edited by coot on Mon Jun 19, 2017 1:46 pm, edited 1 time in total.
coot
CodeLite Enthusiast
Posts: 20
Joined: Thu Jun 15, 2017 1:41 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: different compile behavior between codelite and command

Post by coot »

It solved.

:shock:
After I run

Code: Select all

mingw32-make -j8 -e
in command line, the project compiled successfully in codelite. (even rebuild in codelite)
I am not sure why, but it works now.
Post Reply