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

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
3rd party libraries: compiling does not work
« on: March 29, 2014, 08:56:51 pm »
Hello,
Using C::B has been great, but now I run into trouble using 3rd party libraries. I have been looking for solutions on the net.
Your help would be greatly appreciated!

Issue:
no result display in console window anymore (it would work before I started setting up 3rd party libraries).

Description:
Previously used *.cpp files displayed result as expected in console window.
Now, for a new project, I have to install multiple libraries. After doing so,
and following steps on how to do so, the console window is not displaying the results anymore.

I followed these steps for using 3rd party libraries:
1. create project, 2. right click project/build options../linker settings/add library file *.lib;
tab 'search directories'/compiler/add folder with library files; same folder added in 'linker' tab
3. menu 'project'/set program's arguments../add host application under 'debug' & 'release' // I tried
file 'cb_console_runner.exe' and file 'codeblocks.exe' and check 'run host in terminal'; neither file
provides console window with result

Message in build log:
Build: target is up to date. Nothing to be done
Run: console window "usage: cb_console_runner <filename> <args..>" (for link to file 'cb_console_runner.exe');
Run: console window 1st line empty (for link changed to file 'codeblocks.exe')
Tab: process terminated with status -107374...

a source for my library settings:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: 3rd party libraries: compiling does not work
« Reply #1 on: March 29, 2014, 09:32:25 pm »
Post a build log of a rebuild!!
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Are you compiling a library or a program?

Tim S.
« Last Edit: March 29, 2014, 09:42:20 pm 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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: 3rd party libraries: compiling does not work
« Reply #2 on: March 29, 2014, 09:38:31 pm »
Why do you want to run the library (?) through codeblocks or cb_console_runner ?
What do you want to achieve ?
It does not make any sens !

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #3 on: March 29, 2014, 09:56:11 pm »
Thank you for your replies.

I'm running a program that is referring to a 3rd party library. e.g. starting file '*.cpp' this way:
Code
#include <iostream>
#include "simpio.h"  // 3rd party library
using namespace std;

so the challenge I have is incorporating the 3rd party library in compiling the '*.cpp' file.
also, I have other 3rd party libraries, so this is 1 example of many.
« Last Edit: March 30, 2014, 04:08:58 am by zeno »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
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 #5 on: March 30, 2014, 09:26:57 pm »
this is my build log of a rebuild for *.cpp file:

Quote
-------------- Build: Debug in CS106 (compiler: GNU GCC Compiler)---------------
Target is up to date.
Nothing to be done (all items are up-to-date).

'CS106' is name of C::B project
the '*.cpp' file creates a corresponding '*.exe' file and '*.o' file but the resulting console window is incorrect/empty.
« Last Edit: March 30, 2014, 09:32:08 pm by zeno »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: 3rd party libraries: compiling does not work
« Reply #6 on: March 30, 2014, 10:04:51 pm »
What about doing a full rebuild?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #7 on: March 30, 2014, 11:03:01 pm »
this is the build log for build and run:

Quote
\Project CodeBlocks\CS106B\libCourse CS106B.a
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Program Files (x86)\CodeBlocks\codeblocks.exe"  (in C:\Users\Project CodeBlocks\CS106B\)
Process terminated with status -1073741510 (0 minutes, 12 seconds)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: 3rd party libraries: compiling does not work
« Reply #8 on: March 30, 2014, 11:28:28 pm »
this is the build log for build and run:

Quote
\Project CodeBlocks\CS106B\libCourse CS106B.a
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Program Files (x86)\CodeBlocks\codeblocks.exe"  (in C:\Users\Project CodeBlocks\CS106B\)
Process terminated with status -1073741510 (0 minutes, 12 seconds)

Why do you want to run the library (?) through codeblocks or cb_console_runner ?
What do you want to achieve ?
It does not make any sens !


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: 3rd party libraries: compiling does not work
« Reply #9 on: March 30, 2014, 11:46:15 pm »
this is the build log for build and run:

Quote
\Project CodeBlocks\CS106B\libCourse CS106B.a
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Program Files (x86)\CodeBlocks\codeblocks.exe"  (in C:\Users\Project CodeBlocks\CS106B\)
Process terminated with status -1073741510 (0 minutes, 12 seconds)

Do a re-build and post the build log; this is the last request before I put you on list of people to ignore!

"Build" -> "rebuild"

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 #10 on: March 31, 2014, 06:28:28 pm »
I'm sorry for my misunderstanding.

This is the result I obtain from 'build' > 'rebuild' in the 'build log' tab:

Quote
-------------- Build: Debug in CS106B (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -Wall -g    -I"..\..\C++ Libraries \cs106\" -I"C:\Users\Algorithm\C++\Libraries"  -c "C:\Users\Algorithm\C++\cpp files\1.3 powertab.cpp" -o "obj\Debug\cpp files\1.3 powertab.o"
mingw32-g++.exe: error: Learning\Algorithm\C++: No such file or directory
mingw32-g++.exe: error: St\C++: No such file or directory
mingw32-g++.exe: error: Libraries: No such file or directory
mingw32-g++.exe: error: St  -c C:\Users\XF: Invalid argument
mingw32-g++.exe: error: Learning\Algorithm\C++: No such file or directory
mingw32-g++.exe: error: St\cpp: No such file or directory
mingw32-g++.exe: error: files\1.3: No such file or directory
mingw32-g++.exe: error: powertab.cpp -o obj\Debug\cpp: No such file or directory
mingw32-g++.exe: error: files\1.3: No such file or directory
mingw32-g++.exe: error: powertab.o: No such file or directory
Process terminated with status 1 (0 minutes, 4 seconds)
9 errors, 0 warnings (0 minutes, 4 seconds)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: 3rd party libraries: compiling does not work
« Reply #11 on: March 31, 2014, 11:20:54 pm »
I'm sorry for my misunderstanding.

This is the result I obtain from 'build' > 'rebuild' in the 'build log' tab:

Quote
-------------- Build: Debug in CS106B (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -Wall -g    -I"..\..\C++ Libraries \cs106\" -I"C:\Users\Algorithm\C++\Libraries"  -c "C:\Users\Algorithm\C++\cpp files\1.3 powertab.cpp" -o "obj\Debug\cpp files\1.3 powertab.o"
mingw32-g++.exe: error: Learning\Algorithm\C++: No such file or directory
mingw32-g++.exe: error: St\C++: No such file or directory
mingw32-g++.exe: error: Libraries: No such file or directory
mingw32-g++.exe: error: St  -c C:\Users\XF: Invalid argument
mingw32-g++.exe: error: Learning\Algorithm\C++: No such file or directory
mingw32-g++.exe: error: St\cpp: No such file or directory
mingw32-g++.exe: error: files\1.3: No such file or directory
mingw32-g++.exe: error: powertab.cpp -o obj\Debug\cpp: No such file or directory
mingw32-g++.exe: error: files\1.3: No such file or directory
mingw32-g++.exe: error: powertab.o: No such file or directory
Process terminated with status 1 (0 minutes, 4 seconds)
9 errors, 0 warnings (0 minutes, 4 seconds)

My best guess you have a Toolchain/Compiler that has issues with spaces in the paths.
I suggest getting rid of the spaces and see if the error changes.

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 #12 on: April 01, 2014, 01:15:00 am »
My compiler is Code::Blocks
If I understand correctly, Code::Blocks has problem compiling with 3rd party libraries if a folder name has spaces, so the path as well?
Is there a limitation in the path length, or should the folder be 'close' to the root C-drive?
Thanks again for your help.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: 3rd party libraries: compiling does not work
« Reply #13 on: April 01, 2014, 01:35:54 am »
My compiler is Code::Blocks
No Codeblocks is not a compiler. Codeblocks is a IDE. Your compiler is the mingw-gcc compiler... The compiler is a 3th party software in c::b...

It is general advise  to use only ASCII characters without spaces, and symbols like - ? , ~ ...

Offline zeno

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: 3rd party libraries: compiling does not work
« Reply #14 on: April 01, 2014, 12:18:40 pm »
Thank you everyone for your advice!
I have shortened names of folders (and the path) so as not to have any spaces, and as a result the 'rebuild' is working. This is a nice step forward!

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.
« Last Edit: April 01, 2014, 12:25:15 pm by zeno »

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: 7588
    • 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: 7588
    • 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 »