IRC Log Viewer » #firebreath » 2012-07-18

IRC Nick Time (GMT-7) Message
beezboy 04:07 Hi guys
I have one question
I am trying to compile one file.c and file.h with PluginName.cpp
I added [^.]*.c in CmakeLists
But my compiler don't have rules for build the target
Any solution? Thx
jshanab 05:07 It might help if you told us which compiler. But since c++ is a superset of C, just change your file extension to cpp and it should build it.
beezboy 05:07 Yes, the compiler I think is g++
The problem is that in future I need user some libraries that have many .c files
jshanab 05:07 switch to GCC (Gnu Compiler Collection) and it will auto switch. g++ is being specific
beezboy 05:07 I use the Make file of build/ directory, I think that compiles is g++
I renamed the file to .cpp and i have the "undefined reference to"
error
I am reading the http://www.firebreath.org/display/documentation/Using+Libraries
jshanab 06:07 undefined reference to what? undefined reference has nothing to do with .c vs .cpp it has to do with not finding a header or something wrong in the file. (there could be an if def.
For using live 555 I have to wrap the header in "extern c{ }" to use a C library and header from c++
beezboy 06:07 to a test function
int number(int num)
jshanab 06:07 There are just too many things it could be to offer help without seeing the error and/or the code (Pastebin)
beezboy 06:07 ok
This is the code: http://pastebin.com/X7HHuqaU
I deleted the [^.]*.c
When I compile the compiler prints undefined reference to number()
I think that Makefile o something likethis dont catch .c file
And sorry, extern C is in h file
jshanab 06:07 Well I do not see anything wrong. Where is the compiler's complaint. Although number seems so common that maybe it is already used ? try my_number as a test
beezboy 06:07 I Try with test_a and the same error
undefined reference to `test_a'
I executed build/make
[ 1%] Built target FireBreath_Cmake [ 5%] Built target boost_thread ....
and finally the error
When i put the implementation in number.h/test.h... all works perfectly
I think that Makefile is not catching external files
if I put #include "number.h" #include "number.c" alls work
what I can change in Makefile for link .c files
I think is the question
But I am not expert :(
jshanab 06:07 oh, doo. You said you tried .cpp and also tried extern but neither were in your pastebin. C++ uses name mangalling to include the types in function signatures so it can do things like overloading. C does not. So the nameing conventions do not mach and as far as the compiler knows the nemaes are just different
wrap the c include in the c++ file with extern C { ...} and see if that does the trick. the other way I would have to google for, I just push everything I own to c++.
reference : http://www.parashift.com/c++-faq/mixing-c-and-cpp.html
beezboy 06:07 I put extern "C" { #include "number.h" } in NamePluginAPI.cpp and undefined refenrece...
jshanab 06:07 I gotta run to work. I am running a bit late. I will be back online later and others more capable of answering will be online in 1-2 hours as there timezone comes in. Good luck. Read that web page that is all I ever needed.
beezboy 06:07 Ok Thanks for help and sorry my ignorance
jshanab 06:07 I have been working with computers for more years than I would like to admit. What I have realized is that there is soo much out there that a person can be an idiot and a genious in the same line of code. :-)
beezboy 06:07 ;D I am a developer, but C/C++ is not my territory. I studied C and programmed something... but I forget many things.
Thanks for your help
And good luck too
See u next time
zakarya 08:07 Hello
I'm trying to save the dom document on my desk
I found a code in the tutoriel
but I don't know where to add it
this is the code :
#include "DOM/Window.h" ... // Retrieve a reference to the DOM Window FB::DOM::WindowPtr window = m_host->getDOMWindow(); // Check if the DOM Window has the navigator object if (window && window->getJSObject()->HasProperty("navigator")) { std::string userAgent = window->getNode("navigator")->getProperty<std::string>("userAgent"); } ...
sorry
this is the code I found
:
 FB::DOM::WindowPtr window = m_host->getDOMWindow();
if (window && window->getJSObject()->HasProperty("navigator")) {
std::string userAgent = window->getNode("navigator")->getProperty<std::string>("userAgent");
thanks for helping me
I realy need it
I m working on a project
and I m not verry good on c++
jshanab_ 17:07 Darn. tutorial Video #2 stops at 43 seconds. Must of gotten corrupted?