User forums > Using Code::Blocks
How do I link files together in codeblock ?
fabien:
I did "Build"->"Build workspace" and then the build log I obtained was :
-------------- Build: Debug in GraphsForNauty ---------------
Target is up to date.
-------------- Build: Debug in illustration5 ---------------
Target is up to date.
-------------- Build: Debug in EasyNauty2 ---------------
Target is up to date.
Nothing to be done.
And the program runs but never finish.
Then I erased the #include filex.c because as you said they shouldn't be there and I got in the build log :
-------------- Build: Debug in GraphsForNauty ---------------
mingw32-g++.exe -o bin\Debug\GraphsForNauty.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/langageC/GraphsForNauty/main.c:226: undefined reference to `_nauty_check'
C:/langageC/GraphsForNauty/main.c:238: undefined reference to `_nauty'
C:/langageC/GraphsForNauty/main.c:335: undefined reference to `_dispatch_graph'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings
MortenMacFly:
--- Quote from: fabien on March 10, 2010, 08:16:45 am ---And the program runs but never finish.
--- End quote ---
--- Quote from: fabien on March 10, 2010, 08:16:45 am ---Then I erased the #include filex.c because as you said they shouldn't be there and I got in the build log :
--- End quote ---
Look: The first one is not a Code::Blocks issue - you did something wrong in your application obviously. This forum can't and won't help you because it is out of the scope of Code::Blocks.
The second one is related to basic understanding of programming. Of course you receive linker errors like "undefined references" if you remove parts of the implementation. However, including plain C files instead of just header files in your code is something not very common, but maybe needed within the scope of your work. Again: This forum can't and won't help you because it is out of the scope of Code::Blocks.
Some final hints before I lock the topic as it massively violates our forum rules:
- Grab yourself a book/article about the basics of how a compiler / linker works.
- Try compiling an application of 2..n files at the command line to understand what you have to provide to the compiler / linker.
- Then return back to the (any) IDE and setup the project accordingly concerning include path's for the compiler/linker, flags for the compiler/linker, files etc.
- Instead of including the C file, add the file to your project so it gets compiled / linked into your application.
- When working with more than one source file you will need to setup a project.
Navigation
[0] Message Index
[*] Previous page
Go to full version