Author Topic: 3rd party libraries: compiling does not work  (Read 21888 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 3rd party libraries: compiling does not work
« Reply #15 on: April 01, 2014, 12:41:44 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.

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)....

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #16 on: April 01, 2014, 01:07:29 pm »
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.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 3rd party libraries: compiling does not work
« Reply #17 on: April 01, 2014, 01:25:21 pm »
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...

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #18 on: April 02, 2014, 01:19:51 am »
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))
« Last Edit: April 02, 2014, 01:29:11 am by zeno »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: 3rd party libraries: compiling does not work
« Reply #19 on: April 02, 2014, 02:30:05 am »
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.
 
« Last Edit: April 02, 2014, 03:22:37 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 3rd party libraries: compiling does not work
« Reply #20 on: April 02, 2014, 08:59:57 am »
I have googeled your "library" and i think this is this standford programming course or? If so: you have a source library. Simple copy all .cpp and .h files in your project directory and add them to your project (right click on project->add files).

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #21 on: April 02, 2014, 04:10:54 pm »
Path of header files: C:\MinGW\include\cs106_full_cpp_library\
This is also the path I have defined in 'project>build options>linker settings' and '>>search directories'
Path of C::B project file: C:\Users\Algorithm\C++ St\Project CodeBlocks\CS106 so it has spaces, and so a problem?
File 'CS106.cbp' has size 1KB (too small?) and is attached.
I have added the header files recursively to the project.
Also, I have reinstalled C::B directly on c-drive and made sure not to have any spaces in folder names (which might be an issue in default installation?).
BlueHazzard: this is indeed one of the exercises... and I believe I have already done what you suggest.
« Last Edit: April 02, 2014, 05:13:04 pm by zeno »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: 3rd party libraries: compiling does not work
« Reply #22 on: April 02, 2014, 05:14:55 pm »
Path of header files: C:\MinGW\include\cs106_full_cpp_library\
This is also the path I have defined in 'project>build options>linker settings' and '>>search directories'
Path of C::B project file: C:\Users\Algorithm\C++ St\Project CodeBlocks\CS106 so it has spaces, and so a problem?
File 'CS106.cbp' has size 1KB (too small?) and is attached.
I have added the header files recursively to the project.
Also, I have reinstalled C::B directly on c-drive and made sure not to have any spaces in folder names (which might be an issue in default installation?).
BlueHazzard: this is indeed one of the exercises... and I believe I have already done what you suggest.

You have no source files in your project!!!!!!

Do what BlueHazzard suggested.

Bye, I am tired of wasting my time trying to help you.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #23 on: April 02, 2014, 05:55:59 pm »
I attach codeblocks image so that you can see for yourself that these files are added to the project, both source and header files, as needed to build the file.
I even have the header file in that project open, as you can see. The path to this file is defined, as I mentioned already a few times.
I have also tried to resolve the 'spaces in path' problem. I have recreated the project again, and I have reinstalled codeblocks.
Any of your suggestions I have not yet tried are kindly appreciated.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 3rd party libraries: compiling does not work
« Reply #24 on: April 02, 2014, 10:13:06 pm »
please, please don't use any directories. You are a beginner, and this makes things more difficult that they are...
copy all your cpp and header files in one directory and add them to your project... so you don't need any paths to set up...

In the future please say that you are using a source library. because we assumed that you are using a binary library, and so u confused us...

greetings
« Last Edit: April 02, 2014, 10:31:55 pm by BlueHazzard »