Gcc arguments?

Post Reply
X14U2NVX
Posts: 4
Joined: Fri Jun 17, 2016 10:00 pm

Gcc arguments?

Post by X14U2NVX »

Having followed the basic bullet installation tutorials, I can't seem to get the basicdemo's main.cpp function to compile or run. The standalone release executables, such as the ExampleBrowser work like a charm and there were no issues during the bullet source compile or installation (Ubuntu 14.04 LTS). However, when I go to compile basicdemo's main.cpp function, the compiler claims that there's an undefined reference to BasicExampleCreateFunc(CommonExampleOptions&), even though that function can be found in in the included BasicExample.h file. I am running gcc from a terminal in that directory, so I have no idea why it's reading BasicExample.h but is unable to find the function. I am unsure if this has to do with my additional gcc linking arguments, as I can't find a consistent answer on what needs to be included and what doesn't anywhere.

Is there a tutorial for compiling from terminal? How in the world can main claim that this is an undefined reference?
pinkisntwell
Posts: 11
Joined: Tue May 31, 2016 3:38 pm

Re: Gcc arguments?

Post by pinkisntwell »

"undefined reference" is a linker error so it has nothing to do with an .h file. Make sure you pass the appropriate -L and -l options to gcc and you will be fine. Note that for the -l argument it matters where it is placed in the command line. It should be put after its dependents.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Gcc arguments?

Post by benelot »

Is there a reason why you do not use the premake or Cmake processes to compile? The premake being more up-to-date could do everything for you.
X14U2NVX
Posts: 4
Joined: Fri Jun 17, 2016 10:00 pm

Re: Gcc arguments?

Post by X14U2NVX »

I don't know why or how this issue came about, but I deleted the most recent version of bullet that I had downloaded (bullet3-master from github) and downloaded an older version instead. It worked like a charm. I guess something in my stack was making the compiled bullet3 libraries unusable...

I wasn't using Cmake because I was trying to create the absolute bare minimum standalone project according to tutorials: http://www.bulletphysics.org/mediawiki- ... ello_World and http://www.bulletphysics.org/mediawiki- ... Simple_Box but they were not compiling. I was reverting to an even simpler example (a source code example with no internal dependencies and it wasn't compiling/linking either). So I believed, and in a sense it was, a problem with my libraries and the code I was writing itself.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Gcc arguments?

Post by benelot »

Nice! So now it is working nicely? Cool that you are using the Simple Box tutorial, because it is a new tutorial we just recently made and there are more to come!I hope you liked it. Did you feel anything missing in it?
Post Reply