User forums > Using Code::Blocks

Trouble with Mac OSX and CodeBlock default projects

(1/2) > >>

Clodo:
Hi to all, i hope this is the right forum.

I need to port an application written with CodeBlock & wxWidgets from Linux to Mac OSX.
I'm using C::B 8.02 on Mac OS X Leopard 10.5.
I'm totally newbie about OSX world, for that i'm just starting to discover the differences.

-------------------------------------------------------------------------------------------------------------------
1- From C::B, Menu->New->Project->Shared Library->(all default), simply compiling give an error:

--- Code: ---Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

--- End code ---
I need to put "-dynamiclib" in "other linker options" to link correctly:

--- Code: ---Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Output size is 8.65 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

--- End code ---
It's a known behiavour? It's the right solution?

-------------------------------------------------------------------------------------------------------------------
2- Menu->New->Project->wxWidgets project->(all default), compiling ok but when running the window can't be activated.
I understand that i need to create a "bundle" structure with a "info.plist", it's correct?
Where? Under bin/Debug? I need to set the executable output to "bin/Debug/Contents/MacOSX" ?

Thanks for feedback!

Clodo:
3- Under C::B Linux, i set the environment variable "LD_RUN_PATH" to "./". This build executables with the info about looking for shared library in the same path of the executable.
Under OSX doesn't work, any ideas? thx!

Clodo:
A clarification: i read the topic IMPORTANT! BEFORE ASKING FOR HELP, and, for that, i ask only questions related to CodeBlocks and their default projects wizard (a newbie can expect that this generated projects by C::B can run out-of-the-box, right?). Ok, question (3) is out, sorry.
If this isn't the right forum, anyone can direct me to a correct place, please? Thx.

afb:

--- Quote from: Clodo on January 15, 2009, 04:49:39 pm ---1- From C::B, Menu->New->Project->Shared Library->(all default), simply compiling give an error:

--- Code: ---Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

--- End code ---
I need to put "-dynamiclib" in "other linker options" to link correctly:

--- Code: ---Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Output size is 8.65 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

--- End code ---
It's a known behiavour? It's the right solution?

--- End quote ---

You are correct, -shared is currently hardcoded while Mac OS X uses -dynamiclib

So the workaround is correct, but it should handle this automatically for you really...


--- Quote ---2- Menu->New->Project->wxWidgets project->(all default), compiling ok but when running the window can't be activated.
I understand that i need to create a "bundle" structure with a "info.plist", it's correct?
Where? Under bin/Debug? I need to set the executable output to "bin/Debug/Contents/MacOSX" ?

Thanks for feedback!

--- End quote ---

Yes, although the correct path is something like bin/Debug/Test.app/Contents/MacOS/Test

Again, the wxWidgets template should add these commands for you instead of current Rez.

Clodo:

--- Quote from: afb on January 16, 2009, 01:04:51 am ---So the workaround is correct, but it should handle this automatically for you really...
...
Again, the wxWidgets template should add these commands for you instead of current Rez.

--- End quote ---
Thanks for reply!
Normally a newbie expect that a generated project from a wizard can run out-of-the-box, imho.
So, "-shared" it's automatically handled and "-dynamiclib" not, why? because C::B are more used under Linux and less used under Mac?  :wink:
Obviously it's your program and your decision about that; i reach my objective: a confirm of workaround, a topic that other people with same problem can reach, your confirm that's a known behiavour. Thanks again. Bye!

Navigation

[0] Message Index

[#] Next page

Go to full version