public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Confusing undefined function which I know is defined
@ 2013-11-10  7:45 awsdert
  2013-11-10  8:15 ` awsdert
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: awsdert @ 2013-11-10  7:45 UTC (permalink / raw)
  To: gcc-help

The code is on http://code.google.com/p/zxstuff/source/checkout and here is
the Code::Blocks Project zxStuff.zip
<http://gcc.1065356.n5.nabble.com/file/n983603/zxStuff.zip>  , my problem is
that the compiler thinks zxVECTOR_resize & zxVECTOR_opAdd are undefined and
just stop there (the stopping is desired btw). I cannot for the life of me
figure out why this is.



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10  7:45 Confusing undefined function which I know is defined awsdert
@ 2013-11-10  8:15 ` awsdert
  2013-11-10  9:00 ` awsdert
  2013-11-10 13:06 ` Jonathan Wakely
  2 siblings, 0 replies; 11+ messages in thread
From: awsdert @ 2013-11-10  8:15 UTC (permalink / raw)
  To: gcc-help

Forgot to provide compiler output:




--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p983614.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10  7:45 Confusing undefined function which I know is defined awsdert
  2013-11-10  8:15 ` awsdert
@ 2013-11-10  9:00 ` awsdert
  2013-11-10 13:06 ` Jonathan Wakely
  2 siblings, 0 replies; 11+ messages in thread
From: awsdert @ 2013-11-10  9:00 UTC (permalink / raw)
  To: gcc-help

Will be at work for a while, don't check back until tomorrow



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p983627.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10  7:45 Confusing undefined function which I know is defined awsdert
  2013-11-10  8:15 ` awsdert
  2013-11-10  9:00 ` awsdert
@ 2013-11-10 13:06 ` Jonathan Wakely
  2013-11-10 20:52   ` awsdert
  2 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2013-11-10 13:06 UTC (permalink / raw)
  To: awsdert; +Cc: gcc-help

On 10 November 2013 07:45, awsdert wrote:
> The code is on http://code.google.com/p/zxstuff/source/checkout and here is
> the Code::Blocks Project zxStuff.zip
> <http://gcc.1065356.n5.nabble.com/file/n983603/zxStuff.zip>  , my problem is
> that the compiler thinks zxVECTOR_resize & zxVECTOR_opAdd are undefined and
> just stop there (the stopping is desired btw). I cannot for the life of me
> figure out why this is.

Noone can give a sensible answer until you show the linker output, but
it probably means you haven't linked the relevant objects into your
project.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10 13:06 ` Jonathan Wakely
@ 2013-11-10 20:52   ` awsdert
  2013-11-10 21:58     ` Jonathan Wakely
  0 siblings, 1 reply; 11+ messages in thread
From: awsdert @ 2013-11-10 20:52 UTC (permalink / raw)
  To: gcc-help

It shouldn't be a linker issue given that it is being compiled into 1 DLL at
the moment, also I thought I had sent the output, shows up here:
http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-td983603.html#a983627
where the problem was originally posted. If there is something else I'm
looking for to send you then please tell me.



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p983803.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10 20:52   ` awsdert
@ 2013-11-10 21:58     ` Jonathan Wakely
  2013-11-10 22:20       ` JonY
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2013-11-10 21:58 UTC (permalink / raw)
  To: awsdert; +Cc: gcc-help

On 10 November 2013 20:52, awsdert wrote:
> It shouldn't be a linker issue given that it is being compiled into 1 DLL at
> the moment, also I thought I had sent the output, shows up here:
> http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-td983603.html#a983627
> where the problem was originally posted. If there is something else I'm
> looking for to send you then please tell me.

It doesn't show up in the official list archives:
http://gcc.gnu.org/ml/gcc-help/2013-11/msg00061.html

Nabble.com is not the home of this list, and apparently doesn't
accurately forward what you posted.

For the benefit of this list:

-------------- Build: msw86d_cpp_gcc in zxStuff (compiler: GNU GCC
Compiler)---------------

mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
-DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\endian\zxcopy.c -o
.objs\src\zx\endian\zxcopy.o
mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
-DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\endian\zxcopybits.c -o
.objs\src\zx\endian\zxcopybits.o
mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
-DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\endian\zxIntEndian.c -o
.objs\src\zx\endian\zxIntEndian.o
mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
-DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\event\zxEVENT.c -o
.objs\src\zx\event\zxEVENT.o
C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0xfc):
undefined reference to `zxVECTOR_resize'
C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0x100):
undefined reference to `zxVECTOR_opAdd'
c:/apps86/tools/codeblocks12-11/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o: bad reloc address 0x100 in
section `.data'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
2 errors, 0 warnings (0 minutes, 3 seconds)


As I thought, the errors shown are linker errors, not compiler errors.
 You are using -shared to compile single object files, that is wrong.
You probably want to use -fPIC to compile each file, then use -shared
to combine them into a single .dll file.  So your codeblocks settings
must be wrong, but that is not a GCC problem so this is the wrong
mailing list.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10 21:58     ` Jonathan Wakely
@ 2013-11-10 22:20       ` JonY
  2013-11-11  7:05         ` awsdert
  0 siblings, 1 reply; 11+ messages in thread
From: JonY @ 2013-11-10 22:20 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

On 11/11/2013 05:57, Jonathan Wakely wrote:
> mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
> -DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
> C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\event\zxEVENT.c -o
> .objs\src\zx\event\zxEVENT.o
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0xfc):
> undefined reference to `zxVECTOR_resize'
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0x100):
> undefined reference to `zxVECTOR_opAdd'
> c:/apps86/tools/codeblocks12-11/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o: bad reloc address 0x100 in
> section `.data'
> collect2.exe: error: ld returned 1 exit status
> Process terminated with status 1 (0 minutes, 3 seconds)
> 2 errors, 0 warnings (0 minutes, 3 seconds)
> 
> 
> As I thought, the errors shown are linker errors, not compiler errors.
>  You are using -shared to compile single object files, that is wrong.
> You probably want to use -fPIC to compile each file, then use -shared
> to combine them into a single .dll file.  So your codeblocks settings
> must be wrong, but that is not a GCC problem so this is the wrong
> mailing list.
> 

No, -fpic does not have any function for mingw, it is likely because
-shared and -c are used at the same time.

The linker should not be involved yet if it is just compiling to object.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-10 22:20       ` JonY
@ 2013-11-11  7:05         ` awsdert
  2013-11-11  9:33           ` awsdert
  0 siblings, 1 reply; 11+ messages in thread
From: awsdert @ 2013-11-11  7:05 UTC (permalink / raw)
  To: gcc-help

What does the -c option do? -shared I cannot take off since gcc starts
complaining of missing WinMain, -c was added by Code::Blocks so I do not
know what option to uncheck.



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p983861.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-11  7:05         ` awsdert
@ 2013-11-11  9:33           ` awsdert
  2013-11-12 20:04             ` awsdert
  0 siblings, 1 reply; 11+ messages in thread
From: awsdert @ 2013-11-11  9:33 UTC (permalink / raw)
  To: gcc-help

I looked at the -c option and found that is also necessary for the files to
compile at all, i've got work now so don't expect a response today.



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p983892.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-11  9:33           ` awsdert
@ 2013-11-12 20:04             ` awsdert
  2013-11-13 22:19               ` JonY
  0 siblings, 1 reply; 11+ messages in thread
From: awsdert @ 2013-11-12 20:04 UTC (permalink / raw)
  To: gcc-help

Found part of the issue, I tried disabling the -ansi option and that got me
further, will investigate that issue later but for now I can at least
compile the dll.



--
View this message in context: http://gcc.1065356.n5.nabble.com/Confusing-undefined-function-which-I-know-is-defined-tp983603p984448.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Confusing undefined function which I know is defined
  2013-11-12 20:04             ` awsdert
@ 2013-11-13 22:19               ` JonY
  0 siblings, 0 replies; 11+ messages in thread
From: JonY @ 2013-11-13 22:19 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

On 11/13/2013 04:04, awsdert wrote:
> Found part of the issue, I tried disabling the -ansi option and that got me
> further, will investigate that issue later but for now I can at least
> compile the dll.
> 
> 

-c means compile, -shared is for linking. Build sequence typically goes:

gcc -c ... file1.c
gcc -c ... file2.c
...
gcc -shared ... file1.o file2.o ...

Notice -c and -shared are not used together.

PS, Please quote your messages context properly instead of deleting
everything, it is annoying to read your messages.




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-13 22:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10  7:45 Confusing undefined function which I know is defined awsdert
2013-11-10  8:15 ` awsdert
2013-11-10  9:00 ` awsdert
2013-11-10 13:06 ` Jonathan Wakely
2013-11-10 20:52   ` awsdert
2013-11-10 21:58     ` Jonathan Wakely
2013-11-10 22:20       ` JonY
2013-11-11  7:05         ` awsdert
2013-11-11  9:33           ` awsdert
2013-11-12 20:04             ` awsdert
2013-11-13 22:19               ` JonY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).