Linking problem when using files from other project
Posted: Thu Feb 12, 2015 12:55 am
Hi,
First, Thanks to Eran and everybody else working on this IDE. It is really nice you put so much effort into it and also support multiple operating systems!
System Information:
General Information:
I made a workspace proc_space ( located at C:\cpp_projects\proc_space ) which contains two projects:
game project setup:
I use the standard template library and SFML 2.2 ( located at C:\dev_libs_cpp\SFML-2.2 )
game.project (build configuration):
game project debug build output (works ):
In the game project the subfolder Debug is created (see contents below):
To run the game I need to add the sfml dlls but I omit that part here.
Here the problems start
game_test project setup:
In the game_test project I want to test certain functionality of project game.
I use the Unittest++ (located at C:\UnitTest++-1.3 ) and again SFML 2.2 ( located at C:\dev_libs_cpp\SFML-2.2 )
game_test.project (build configuration):
TLDR version (only linker information:
My main.cpp looks like this:
There is no CHECK used right now but that does not matter.
When I try to compile this I get the following output:
TLDR version (only error message):
I tried to change the Library in the configuration to QuadTree.cpp.o.d but it gave me a similar error. I also tried to compile game project in Release configuration (that's why also the Release folder is in the linker folders of game_test project) before running the game_test build.
Do I perhaps miss something?
Thanks for any help, suggestions. I hope I didn't paste too much text.
First, Thanks to Eran and everybody else working on this IDE. It is really nice you put so much effort into it and also support multiple operating systems!
System Information:
Code: Select all
OS: : Windows 7, 64 Bit
CodeLite : version 7.0 , 64 Bit
- codelite-amd64-7.0.exe from the homepage)
- installed to folder C:\Program Files\CodeLite
Compiler : Mingw 4.8.1
- installed to folder C:\MinGW-4.8.1
I made a workspace proc_space ( located at C:\cpp_projects\proc_space ) which contains two projects:
- game
- game_test
Code: Select all
proc_space
├───game
│ Bomb.hpp
│ Bullet.hpp
│ Constants.hpp
│ Entity.hpp
│ Game.cpp
│ Game.hpp
│ game.mk
│ game.project
│ game.txt
│ main.cpp
│ main.hpp
│ qt.hpp
│ QuadTree.cpp
│ QuadTree.hpp
│ Ship.hpp
│ SpatialHash.cpp
│ SpatialHash.hpp
│
└───game_test
game_test.mk
game_test.project
game_test.txt
main.cpp
I use the standard template library and SFML 2.2 ( located at C:\dev_libs_cpp\SFML-2.2 )
game.project (build configuration):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="game" InternalType="Console">
<Plugins>
<Plugin Name="qmake">
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
</Plugin>
<Plugin Name="CMakePlugin">
<![CDATA[[{
"name": "Debug",
"enabled": false,
"buildDirectory": "build",
"sourceDirectory": "$(ProjectPath)",
"generator": "",
"buildType": "",
"arguments": [],
"parentProject": ""
}, {
"name": "Release",
"enabled": false,
"buildDirectory": "build",
"sourceDirectory": "$(ProjectPath)",
"generator": "",
"buildType": "",
"arguments": [],
"parentProject": ""
}]]]>
</Plugin>
</Plugins>
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
<File Name="main.cpp"/>
<File Name="Entity.hpp"/>
<File Name="main.hpp"/>
<File Name="Ship.hpp"/>
<File Name="Game.hpp"/>
<File Name="Game.cpp"/>
<File Name="Bullet.hpp"/>
<File Name="Constants.hpp"/>
<File Name="Bomb.hpp"/>
<File Name="SpatialHash.hpp"/>
<File Name="SpatialHash.cpp"/>
<File Name="QuadTree.hpp"/>
<File Name="QuadTree.cpp"/>
</VirtualDirectory>
<Settings Type="Executable">
<GlobalSettings>
<Compiler Options="" C_Options="" Assembler="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="MinGW ( CodeLite-4.8.1 )" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g;-O0;-std=c++11;-Wall" C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
<IncludePath Value="C:/dev_libs_cpp/SFML-2.2/include"/>
</Compiler>
<Linker Options="" Required="yes">
<LibraryPath Value="C:/dev_libs_cpp/SFML-2.2/lib"/>
<Library Value="sfml-main-d"/>
<Library Value="sfml-system-d"/>
<Library Value="sfml-graphics-d"/>
<Library Value="sfml-window-d"/>
<Library Value="sfml-audio-d"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="MinGW ( CodeLite-4.8.1 )" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-O2;-std=c++11;-Wall" C_Options="-O2;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
<IncludePath Value="C:/dev_libs_cpp/SFML-2.2/include"/>
<Preprocessor Value="NDEBUG"/>
</Compiler>
<Linker Options="" Required="yes">
<LibraryPath Value="C:/dev_libs_cpp/SFML-2.2/lib"/>
<Library Value="sfml-main-d"/>
<Library Value="sfml-system-d"/>
<Library Value="sfml-graphics-d"/>
<Library Value="sfml-window-d"/>
<Library Value="sfml-audio-d"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Release" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>
Code: Select all
C:\Windows\system32\cmd.exe /C "C:/MinGW-4.8.1/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ game - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/cpp_projects/proc_space/game'
C:/MinGW-4.8.1/bin/g++.exe -c "C:/cpp_projects/proc_space/game/main.cpp" -g -O0 -std=c++11 -Wall -o ./Debug/main.cpp.o -I. -I. -IC:/dev_libs_cpp/SFML-2.2/include
C:/MinGW-4.8.1/bin/g++.exe -c "C:/cpp_projects/proc_space/game/Game.cpp" -g -O0 -std=c++11 -Wall -o ./Debug/Game.cpp.o -I. -I. -IC:/dev_libs_cpp/SFML-2.2/include
C:/MinGW-4.8.1/bin/g++.exe -c "C:/cpp_projects/proc_space/game/SpatialHash.cpp" -g -O0 -std=c++11 -Wall -o ./Debug/SpatialHash.cpp.o -I. -I. -IC:/dev_libs_cpp/SFML-2.2/include
C:/MinGW-4.8.1/bin/g++.exe -c "C:/cpp_projects/proc_space/game/QuadTree.cpp" -g -O0 -std=c++11 -Wall -o ./Debug/QuadTree.cpp.o -I. -I. -IC:/dev_libs_cpp/SFML-2.2/include
C:/MinGW-4.8.1/bin/g++.exe -o ./Debug/game @"game.txt" -L. -LC:/dev_libs_cpp/SFML-2.2/lib -lsfml-main-d -lsfml-system-d -lsfml-graphics-d -lsfml-window-d -lsfml-audio-d
mingw32-make.exe[1]: Leaving directory 'C:/cpp_projects/proc_space/game'
0 errors, 0 warnings
Code: Select all
.d
Game.cpp.o
Game.cpp.o.d
game.exe
main.cpp.o
main.cpp.o.d
QuadTree.cpp.o
QuadTree.cpp.o.d
SpatialHash.cpp.o
SpatialHash.cpp.o.d
Here the problems start
game_test project setup:
In the game_test project I want to test certain functionality of project game.
I use the Unittest++ (located at C:\UnitTest++-1.3 ) and again SFML 2.2 ( located at C:\dev_libs_cpp\SFML-2.2 )
game_test.project (build configuration):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="game_test" InternalType="UnitTest++">
<Plugins>
<Plugin Name="qmake">
<![CDATA[00010001N0005Debug000000000000]]>
</Plugin>
<Plugin Name="CMakePlugin">
<![CDATA[[{
"name": "Debug",
"enabled": false,
"buildDirectory": "build",
"sourceDirectory": "$(ProjectPath)",
"generator": "",
"buildType": "",
"arguments": [],
"parentProject": ""
}, {
"name": "Release",
"enabled": false,
"buildDirectory": "build",
"sourceDirectory": "$(ProjectPath)",
"generator": "",
"buildType": "",
"arguments": [],
"parentProject": ""
}]]]>
</Plugin>
</Plugins>
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
<File Name="main.cpp"/>
</VirtualDirectory>
<Settings Type="Executable">
<GlobalSettings>
<Compiler Options="" C_Options="" Assembler="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="MinGW ( CodeLite-4.8.1 )" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g;-std=c++11" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="$(UNIT_TEST_PP_SRC_DIR)/src"/>
<IncludePath Value="."/>
<IncludePath Value="C:/UnitTest++-1.3/src"/>
<IncludePath Value="C:/dev_libs_cpp/SFML-2.2/include"/>
<IncludePath Value="C:/cpp_projects/proc_space/game"/>
</Compiler>
<Linker Options="" Required="yes">
<LibraryPath Value="$(UNIT_TEST_PP_SRC_DIR)/Debug"/>
<LibraryPath Value="C:/cpp_projects/proc_space/game/Release"/>
<LibraryPath Value="C:/cpp_projects/proc_space/game/Debug"/>
<LibraryPath Value="C:/dev_libs_cpp/SFML-2.2/lib"/>
<Library Value="libUnitTest++.a"/>
<Library Value="QuadTree.cpp.o"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="MinGW ( CodeLite-4.8.1 )" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
<IncludePath Value="$(UNIT_TEST_PP_SRC_DIR)/src"/>
</Compiler>
<Linker Options="-O2" Required="yes">
<LibraryPath Value="$(UNIT_TEST_PP_SRC_DIR)/Release"/>
<Library Value="libUnitTest++.a"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="Release" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>
Code: Select all
<Linker Options="" Required="yes">
<LibraryPath Value="$(UNIT_TEST_PP_SRC_DIR)/Debug"/>
<LibraryPath Value="C:/cpp_projects/proc_space/game/Release"/>
<LibraryPath Value="C:/cpp_projects/proc_space/game/Debug"/>
<LibraryPath Value="C:/dev_libs_cpp/SFML-2.2/lib"/>
<Library Value="libUnitTest++.a"/>
<Library Value="QuadTree.cpp.o"/>
</Linker>
Code: Select all
#include <UnitTest++.h>
#include "SFML\Window.hpp"
#include "QuadTree.hpp"
// run all tests
int main(int argc, char **argv)
{
return UnitTest::RunAllTests();
}
TEST(Test_QuadTree)
{
QuadTree qt = QuadTree(0, sf::Vector2f(0.0f, 0.0f), sf::Vector2f(512.0f, 512.0f));
}
When I try to compile this I get the following output:
Code: Select all
C:\Windows\system32\cmd.exe /C "C:/MinGW-4.8.1/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ game_test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/cpp_projects/proc_space/game_test'
C:/MinGW-4.8.1/bin/g++.exe -c "C:/cpp_projects/proc_space/game_test/main.cpp" -g -std=c++11 -o Debug/main.cpp.o -I. -IC:\UnitTest++-1.3/src -I. -IC:/UnitTest++-1.3/src -IC:/dev_libs_cpp/SFML-2.2/include -IC:/cpp_projects/proc_space/game
C:/MinGW-4.8.1/bin/g++.exe -o Debug/game_test @"game_test.txt" -L. -LC:\UnitTest++-1.3/Debug -LC:/cpp_projects/proc_space/game/Release -LC:/cpp_projects/proc_space/game/Debug -LC:/dev_libs_cpp/SFML-2.2/lib -lUnitTest++ -lQuadTree.cpp.o
c:/mingw-4.8.1/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lQuadTree.cpp.o
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/game_test] Error 1
mingw32-make.exe: *** [All] Error 2
game_test.mk:81: recipe for target 'Debug/game_test' failed
mingw32-make.exe[1]: Leaving directory 'C:/cpp_projects/proc_space/game_test'
Makefile:4: recipe for target 'All' failed
1 errors, 0 warnings
Code: Select all
cannot find -lQuadTree.cpp.o
Do I perhaps miss something?
Thanks for any help, suggestions. I hope I didn't paste too much text.