User forums > Using Code::Blocks

3rd party libraries: compiling does not work

<< < (4/5) > >>

BlueHazzard:

--- Quote from: zeno on April 01, 2014, 12:18:40 pm ---Next I'm checking the result on the console window, which is not yet showing anything and is the same as before.
Could this be  related to field 'host application' in 'project>set program's arguments'? I specified path to 'codeblocks.exe' file and checked 'run host in terminal'. Or is the setting problem different?
I also see that the path here starts 'C:\Program Files (x86)\' so it has spaces.

--- End quote ---

why have you changed that? I think you are trying to run a normal cmd program? So c::bs binary has nothing to do with your binary... c::b is only a IDE, not a text user interface, or any other sort of user interface...
I would recommend you to recreate a new project and leave everything as it is (beside the linker and compiler options)....

zeno:
The reason that I filled in these fields (from my previous message) is that when I run the *.cpp file I receive the message 'you must select a host application to "run" a library...' and nothing happens.

BlueHazzard:
i think you have a deep miss understanding of libraries... This is not the right place to learn such things... and this topic will probably get locked, but i will try to clarify things a bit...

1) As i mentoined 100 times C::B is a IDE, not a compiler, nor a host application for 3party libraries
2) A 3 party library is a dynamically or statically loaded library of functions https://en.wikipedia.org/wiki/Library_%28computing%29 . so she needs a "host" application which calls the functions from the library
3) YOU have to create the "host" program which calls this functions. C::B doesn't know anything about this, but it helps you to create such a program
4) To create a "host" program (i don't know what library you will use nor if it is a GUI or a simple console program) you have to create a new project. As template use either console program or GUI (this depends on your needs...)
5) Then you have to tell c::b where your library is found and what type it is (dynamic or static) this is done with the directories and library settings, it think you made this correct
6) your host needs a main function so the operating system knows where to start your program
7) if you have written your code (with the calls to your library) you can compile it. Here c::b will do the work for you if you have configured the right settings
8) after the compilation and linking is finished c::b will search the output file and execute it, nothing more and nothing less...

zeno:
What I'm trying to achieve is the following: using a created external file (a header file) when building and running the source file (*.cpp). I actually have a whole list of external header files.
I have created a project with both the source file and various header/library files in this project. Yet when I build the source file, I receive a fatal error as if the library/header file is not found.
However, my defined path has no spaces, as defined in 'project>build options>linker settings' and '>>search directories' and is different from the path shown in 'build log' below. So how comes that it is looking in that path and not the one I selected?
This is the message in 'build log' tab:


--- Quote ----------------- Build: Debug in CS106 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -g -I"C:\Users\E\XF L\Algorithm\C++ St\C++ Libraries" -c "C:\Users\E\XF L\Algorithm\C++ St\cpp files\1.3.cpp" -o "obj\Debug\cpp files\1.3.o"
C:\Users\E\XF L\Algorithm\C++ St\cpp files\1.3.cpp:12:48: fatal error: genlib.h: No such file or directory
  #include "genlib.h"  // -> using namespace std
                                                ^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

--- End quote ---

stahta01:
Please post the full path to this "genlib.h" file.
Edit1: Also, post the full path to the Code::Blocks project file; this has the file extension ".cbp".
Edit2: If you zip up the Code::Blocks project file and attach it to your post; I would be able to see if the problem is in it.
(The "+ Additional Options" at bottom of post is how to attach .cbp file.)

Tim S.
 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version