Меню

File format not recognized treating as linker script ошибка

i’m new on gcc compiler.

My friend wrote this script (graphic filter) for me but i can’t use it because i receive some error.

I have 2 directory and a C file:

-dir- include --> basics.h common.h freeimage.h hqx.h imageIO.h pcxIO.h    
-dir- lib --> libfreeimage-3.13.1.so libfreeimage.a libfreeimage.so.3 libhqx.a libhqx.so libhqx.so.1 libhqx.so.1.0.0  
scaling.c

i try to compile with this command:

gcc scaling.c -I./include -L./lib -lm -lfreeimage -lhqx -lstdc++ -o filter

But i receive this error:

/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld:./lib/libhqx.so: file format not recognized; treating as linker script
/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld:./lib/libhqx.so:1: syntax error
collect2: ld returned 1 exit status

Thanks in advance and sorry for my english.

asked Apr 5, 2011 at 14:03

MarcoD's user avatar

The linker will treat any file that doesn’t look like an object file or library as a linker script containing commands to specify how linking should be done. Things like load addresses, section definitions, etc.

Apparently libhqx.so doesn’t look like a shared library on you system. I assume it was built on your friend’s system?

To get a clue about what the file is, use the file command. You should get something like:

main% file /lib/libc-2.11.2.so 
/lib/libc-2.11.2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

If not, you’ll have to build or find a library compatible with your system.

Mike Kinghan's user avatar

Mike Kinghan

53.7k11 gold badges147 silver badges174 bronze badges

answered Apr 5, 2011 at 14:14

Richard Pennington's user avatar

3

I had a similar problem yesterday, and I think your libhqx.so was a symbolic link to libhqx.so.1.0.0 or to libhqx.so.1 in your friend’s machine, and when you copied this files, this link had broken. (at least that was the situation in our system, and the problem solved after we remove the .so file, and create the right symbolic link)

answered Feb 13, 2013 at 14:36

gincsait's user avatar

gincsaitgincsait

1141 silver badge2 bronze badges

0

Environment: centos7.6 oracle19c

To install an Oracle 19C server on Linux, I have not touched the Linux command for a long time. I have almost forgotten about it. After experiencing the problem of no permission (I have permission to view the file attributes, and finally reset the MKDIR path), xdpyinfo and so on, when I finally entered the graphical interface, I had a crash problem

Graphical installation, in the pre check after the install step to report the error dialog box: figure no error, the content is as follows

makefile ‘/oracle/product/10.2.0/db_ 1/rdbms/lib/ins_ Target ‘libasmclntsh19.ohso libasmperl19.ohso client’ of RDBMS. MK ‘_ Error in sharedlib ‘. Please refer to ‘/ TMP/installactions2021-02-04_ 03-36-27PM/installActions2021-02-04_ 03-36-27PM.log’

Then I went to check the error file and found the following:

/usr/bin/ld:/u01/app/oracle/product/19.2.0/db_ 1/lib//libclntsh.so: file format not recognized; treating as linker script

/usr/bin/ld:/u01/app/oracle/product/19.2.0/db_ 1/lib//libclntsh.so:1: syntax error

lib// libclntsh.so How can there be two libclntsh.so//

solution process:

Baidu first, as like as two peas, someone and I have the same problem, the same mistake. Please click the link to set up 1 according to his method. There’s only one environment. His method 2 doesn’t work

Take a look at the actual error. Go to lib and find the libclntsh.so file. It exists, and it’s under lib /. How can there be one more /?View the. Bash of Oracle users_ profile,ORACLE_ HOME,LIB_ Path and other configuration items, no problem, no more writing after lib/

Bing international, there are some foreigners who have encountered this problem in Oracle support. Can we solve this problem?I’m glad to go in and disappointed to come out. The answer is to support the account. It’s a real pit

Let’s take a look at the online installation tutorials (some of the tutorials are pitiful, there are obvious errors, copy and paste if you don’t write them well…), check one by one, I suddenly find a problem, in the tutorial, unzip command is used to unzip, and I unzip the 19C zip package under windows, and then copy the unzip content to CentOS machine with winscp, sure enough, I put the zip package on CentOS, unzip it, and then install it. Finally, this shit problem is gone… Who would have thought

Summary: in the future, things in Linux must be decompressed on Linux

Similar Posts:

@wimmar

I always get this error for libcurl and websockets.. I don’t know much about compilers and linkers (tried a lot of different g++ commands but no avail, always stuck somewhere, also tried installing libcurl and websockets etc and not linking them locally) Help would be greatly appreciated 🙂

make example

Making example

g++ -I../lib/libcurl-7.56.0/include -I../lib/jsoncpp-1.8.3/include -I../lib/libwebsockets-2.4.0/include -I../lib/libbinacpp/include
example.cpp
-L../lib/libcurl-7.56.0/lib
-L../lib/libwebsockets-2.4.0/lib
-L../lib/libbinacpp/lib
-lcurl -ljsoncpp -lcrypto -lwebsockets -lbinacpp -o example
/usr/bin/ld:../lib/libcurl-7.56.0/lib/libcurl.so: file format not recognized; treating as linker script
/usr/bin/ld:../lib/libcurl-7.56.0/lib/libcurl.so:1: syntax error
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target ‘example’ failed
make: *** [example] Error 1

@loogycheung

Hi sir, I also have this problem. I can compile successfully until I update ubuntu14.04 to 16.04 once, this problem happened…..
How to solve it ! Oh god!

@loogycheung

Haha , I find the reason. The zip document should be decompressed in terminal by using instruction «unzip binacpp-master.zip», then all documents will be linked.
1, Right click document to decompression;
2, update linux system;
these two wrong way will cut the link which result to this problem.
Closed !

Архив, на который вы ссылаетесь, содержит исходный код. Чтобы запустить код, вам нужно скомпилировать его в исполняемый файл. Затем вы можете запустить исполняемый файл, если компиляция завершится успешно.

Вот файлы, с которых вам следует начать, прямо из tar-файла:

$ ls
ksg     main.c      sample_ksgs.txt stree.h
ksg.exe sample_docs.txt stree.c     stree.txt

Компилировать

Сначала скомпилируем программу. В -o ksg называет исполняемый файл ksg. Когда gcc ничего не отображает, это означает, что он прошел успешно без каких-либо ошибок или предупреждений.

$ gcc -o ksg main.c stree.c

Run

Теперь мы можем запустить ksg исполняемый файл, который мы только что создали. Синтаксис командной строки: ./ksg <arguments>. Например, мы можем попросить о помощи с ./ksg -?:

$ ./ksg -?
Dell Zhang, Wee Sun Lee.
Extracting Key-Substring-Group Features for Text Classification.
In Proceedings of the 12th ACM SIGKDD International Conference on
   Knowledge Discovery and Data Mining (KDD),
Philadelphia, PA, Aug 2006.

Usage: ksg [options] docs_file ksgs_file

Options:
         -?          -> help
         -s [0,1]    -> assume white-spaces are word delimiters
                        (default 1)
         -l [2..]    -> the minimum frequency
                        (default 2)
         -h [l..]    -> the maximum frequency
                        (default 8,000)
         -b [2..]    -> the minimum number of branches
                        (default 2)
         -p (0..1]   -> the maximum parent-child conditional probability
                        (default 1.0)
         -q (0..1]   -> the maximum suffix-link conditional probability
                        (default 1.0)
Arguments:
         docs_file    -> the input  file with each line as a raw document
         ksgs_file    -> the output file with each line as a bag of ksg features

Hello,

I am working on setting up a 2 NODE RAC on my windows 10 laptop (oracle linux 7 using virtual Box 5.1).

My set up is exactly same as the popular link https://oracle-base.com/articles/12c/oracle-db-12cr2-rac-installation-on-oracle-linux-7-using-virtualbox

Only difference is that my host machine is Windows.

After going through all the prerequisites successfully, grid installation throws an error during the Linking RMAN utility step and i have described the error below in detail.

It does not appear to be the common error others see (like libjavavm not available) . I have 5GB of physical memory allocated to each nodes.

As you can see on the error, there is an added / before the libodm12.so and i am not sure where that is coming from. The environment variable is exactly same as what was given in the link above. I dont see any added slashes anywhere. Hoping someone can assist me in what i am missing. Maybe i missed something during the installation of Linux that would cause this multiple slash? What all places should i look for ?

I looked at ./bash_profile, .bashrc, grid_env,db_env files and i dont have any path with / at the end.  ALso, it appears to be linking all other things fine except Linking Oracle.

INFO:

— Linking Oracle

rm -f /u01/app/12.2.0.1/grid/rdbms/lib/oracle

INFO:

/u01/app/12.2.0.1/grid/bin/orald  -o /u01/app/12.2.0.1/grid/rdbms/lib/oracle -m64 -z noexecstack -Wl,—disable-new-dtags -L/u01/app/12.2.0.1/grid/rdbms/lib/ -L/u01/app/12.2.0.1/grid/lib/ -L/u01/app/12.2.0.1/grid/lib/stubs/   -Wl,-E /u01/app/12.2.0.1/grid/rdbms/lib/opimai.o /u01/app/12.2.0.1/grid/rdbms/lib/ssoraed.o /u01/app/12.2.0.1/grid/rdbms/lib/ttcsoi.o -Wl,—whole-archive -lperfsrv12 -Wl,—no-whole-archive /u01/app/12.2.0.1/grid/lib/nautab.o /u01/app/12.2.0.1/grid/lib/naeet.o /u01/app/12.2.0.1/grid/lib/

INFO:

naect.o /u01/app/12.2.0.1/grid/lib/naedhs.o /u01/app/12.2.0.1/grid/rdbms/lib/config.o  -ldmext -lserver12 -lodm12 -lofs -lcell12 -lnnet12 -lskgxp12 -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lclient12  -lvsn12 -lcommon12 -lgeneric12 -lknlopt `if /usr/bin/ar tv /u01/app/12.2.0.1/grid/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo «-loraolap12» ; fi` -lskjcx12 -lslax12 -lpls12  -lrt -lplp12 -ldmext -l

INFO:

server12 -lclient12  -lvsn12 -lcommon12 -lgeneric12 `if [ -f /u01/app/12.2.0.1/grid/lib/libavserver12.a ] ; then echo «-lavserver12» ; else echo «-lavstub12»; fi` `if [ -f /u01/app/12.2.0.1/grid/lib/libavclient12.a ] ; then echo «-lavclient12» ; fi` -lknlopt -lslax12 -lpls12  -lrt -lplp12 -ljavavm12 -lserver12  -lwwg  `cat /u01/app/12.2.0.1/grid/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lngsmshd12 -lnro12 `cat /u01/app/12.2.0.1/grid/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12

INFO:

-lngsmshd12 -lnnzst12 -lzt12 -lztkg12 -lmm -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lztkg12 `cat /u01/app/12.2.0.1/grid/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lngsmshd12 -lnro12 `cat /u01/app/12.2.0.1/grid/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lngsmshd12 -lnnzst12 -lzt12 -lztkg12   -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -l

INFO:

snls12 -lnls12 -lcore12 -lnls12 `if /usr/bin/ar tv /u01/app/12.2.0.1/grid/rdbms/lib/libknlopt.a | grep «kxmnsd.o» > /dev/null 2>&1 ; then echo » » ; else echo «-lordsdo12 -lserver12»; fi` -L/u01/app/12.2.0.1/grid/ctx/lib/ -lctxc12 -lctx12 -lzx12 -lgx12 -lctx12 -lzx12 -lgx12 -lordimt12 -lclsra12 -ldbcfg12 -lhasgen12 -lskgxn2 -lnnzst12 -lzt12 -lxml12 -lgeneric12 -locr12 -locrb12 -locrutl12 -lhasgen12 -lskgxn2 -lnnzst12 -lzt12 -lxml12 -lgeneric12  -lgeneric12 -lorazip -loraz -llzopro5 -lorabz2 -lipp_z -lipp_bz

INFO:

2 -lippdcemerged -lippsemerged -lippdcmerged  -lippsmerged -lippcore  -lippcpemerged -lippcpmerged  -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lsnls12 -lunls12  -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lasmclnt12 -lcommon12 -lcore12  -laio -lons  -lfthread12   `cat /u01/app/12.2.0.1/grid/lib/sysliblist` -Wl,-rpath,/u01/app/12.2.0.1/

INFO:

grid/lib -lm    `cat /u01/app/12.2.0.1/grid/lib/sysliblist` -ldl -lm   -L/u01/app/12.2.0.1/grid/lib `test -x /usr/bin/hugeedit -a -r /usr/lib64/libhugetlbfs.so && test -r /u01/app/12.2.0.1/grid/rdbms/lib/shugetlbfs.o && echo -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs`

/usr/bin/ld:/u01/app/12.2.0.1/grid/lib//libodm12.so: file format not recognized; treating as linker script

/usr/bin/ld:/u01/app/12.2.0.1/grid/lib//libodm12.so:1: syntax error

INFO:

make: *** [/u01/app/12.2.0.1/grid/rdbms/lib/oracle] Error 1

INFO: End output from spawned process.

INFO: ———————————-

INFO: Exception thrown from action: make

Exception Name: MakefileException

Exception String: Error in invoking target ‘irman ioracle’ of makefile ‘/u01/app/12.2.0.1/grid/rdbms/lib/ins_rdbms.mk’. See ‘/tmp/GridSetupActions2017-04-30_11-54-25AM/gridSetupActions2017-04-30_11-54-25AM.log’ for details.

Exception Severity: 1

Compile seems to work fine but will not link.  Any thoughts?



**** Full rebuild of configuration Release for project Auth ****

make -k clean all 
rm -rf     AuthTest.o AuthTestDlg.o stdafx.o       AuthTest.d AuthTestDlg.d
stdafx.d   Auth.exe
Building file: ../AuthTest.cpp
g++ -O3 -Wall -fpreprocessed -M -v -oAuthTest.o ../AuthTest.cpp
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -M
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__
-D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../AuthTest.cpp -oAuthTest.o -Wall -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -P
-M -MM -MG -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../AuthTest.cpp -Wall -w -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Finished building: ../AuthTest.cpp
 
Building file: ../AuthTestDlg.cpp
g++ -O3 -Wall -fpreprocessed -M -v -oAuthTestDlg.o ../AuthTestDlg.cpp
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -M
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__
-D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../AuthTestDlg.cpp -oAuthTestDlg.o -Wall -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -P
-M -MM -MG -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../AuthTestDlg.cpp -Wall -w -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Finished building: ../AuthTestDlg.cpp
 
Building file: ../stdafx.cpp
g++ -O3 -Wall -fpreprocessed -M -v -ostdafx.o ../stdafx.cpp
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -M
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__
-D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../stdafx.cpp -ostdafx.o -Wall -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -P
-M -MM -MG -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
../stdafx.cpp -Wall -w -fpreprocessed -O3
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.3
 /usr/include/c++/3.3.3/i686-pc-cygwin
 /usr/include/c++/3.3.3/backward
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
 /usr/include
 /usr/include/w32api
End of search list.
Finished building: ../stdafx.cpp
 
Building target: Auth.exe
g++ -v -o Auth.exe     AuthTest.o AuthTestDlg.o stdafx.o    
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/collect2.exe -Bdynamic
--dll-search-prefix=cyg -o Auth.exe
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../crt0.o
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtbegin.o
-L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3
-L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../.. AuthTest.o AuthTestDlg.o
stdafx.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtend.o
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:AuthTest.o:
file format not recognized; treating as linker script
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:AuthTest.o:1:
syntax error
collect2: ld returned 1 exit status
make: *** [Auth.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project Auth


Comment 1


Andrew Pinski



2005-01-05 21:56:50 UTC

This is not a gcc bug, either this is your bug and the .o file is not an object file or this is a binutils bug.


Comment 2


Jeff



2005-01-06 15:33:15 UTC

(In reply to comment #1)
> This is not a gcc bug, either this is your bug and the .o file is not an
object file or this is a binutils bug.

Andrew, then perhaps you can explain why the exact same code compiles, links and
runs fine in a Microsoft environment?  So the only thing that has changed is I
am using GCC....  Hmmmmm..


Comment 3


Andrew Pinski



2005-01-06 15:42:01 UTC

(In reply to comment #2)
> (In reply to comment #1)
> > This is not a gcc bug, either this is your bug and the .o file is not an
> object file or this is a binutils bug.
> 
> Andrew, then perhaps you can explain why the exact same code compiles, links and
> runs fine in a Microsoft environment?  So the only thing that has changed is I
> am using GCC....  Hmmmmm..

But GCC is only the compiler, not the assembler and linker, report this to the binutils project, <http://
sourceware.org/bugzilla/> which controls both the assembler and the linker, yes this is confusing but 
correct.


Comment 4


Jeff



2005-01-10 18:45:41 UTC

Andrew,

A view from the ld folks.  They believe that the ld is failing due to the
-fpreprocessed switch not producing the .o file..

------- Additional Comments From nickc at redhat dot com  2005-01-10 17:57 -------
Subject: Re:  file format not recognized; treating as linker script

Hi Jeff,


>> I tried it with -c same result.  Also, when I ran file on it it says ASCII text.


Hmm, what size is the file ?


>> Here are the messages
>> 
>> **** Full rebuild of configuration Release for project Auth ****

Note - I would strongly suggest that you halt the build process after 
the creation of the first object file.  Things have definitely gone 
wrong by this point.  We are not looking at a linker bug, we are looking 
at a gcc bug or possibly a gas bug.

There appears to be something very odd going on when an object file is 
built:



>> g++ -O3 -Wall -c -fpreprocessed -M -v -oAuthTest.o ../AuthTest.cpp


So G++ is invoked on AuthTest.cpp.  I assume that the "-fpreprocessed" 
switch is correct and that this source file has already been pre-processed ?


>> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
>> Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
>> --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
>> --mandir=/usr/share/man --infodir=/usr/share/info
>> --enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
>> --without-included-gettext --enable-libgcj --with-system-zlib
>> --enable-interpreter --enable-threads=posix --enable-java-gc=boehm
>> --enable-sjlj-exceptions --disable-version-specific-runtime-libs
>> --disable-win32-registry
>> Thread model: posix
>> gcc version 3.3.3 (cygwin special)
>>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -M
>> -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__
>> -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
>> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
>>
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
>> ../AuthTest.cpp -oAuthTest.o -Wall -fpreprocessed -O3


So cc1plus.exe is run once...


>> ignoring nonexistent directory "/usr/local/include"
>> ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
>> ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /usr/include/c++/3.3.3
>>  /usr/include/c++/3.3.3/i686-pc-cygwin
>>  /usr/include/c++/3.3.3/backward
>>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
>>  /usr/include
>>  /usr/include/w32api
>> End of search list.
>> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
>> Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
>> --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
>> --mandir=/usr/share/man --infodir=/usr/share/info
>> --enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
>> --without-included-gettext --enable-libgcj --with-system-zlib
>> --enable-interpreter --enable-threads=posix --enable-java-gc=boehm
>> --enable-sjlj-exceptions --disable-version-specific-runtime-libs
>> --disable-win32-registry
>> Thread model: posix
>> gcc version 3.3.3 (cygwin special)
>>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -P
>> -M -MM -MG -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
>> -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
>> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter
>>
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
>> ../AuthTest.cpp -Wall -w -fpreprocessed -O3


... and then it is run again with the -o switch missing ?  Why ?


>> ignoring nonexistent directory "/usr/local/include"
>> ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
>> ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /usr/include/c++/3.3.3
>>  /usr/include/c++/3.3.3/i686-pc-cygwin
>>  /usr/include/c++/3.3.3/backward
>>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
>>  /usr/include
>>  /usr/include/w32api
>> End of search list.
>> Finished building: ../AuthTest.cpp


... and yet GAS has not been invoked to turn the assembler output of the 
cc1plus.exe program into an object file.

Perhaps ... the g++ driver program is picking the wrong executable to 
use to convert assembler into binary ?

Cheers
   Nick



-- http://sources.redhat.com/bugzilla/show_bug.cgi?id=641 ------- You are
receiving this mail because: ------- You reported the bug, or are watching the
reporter. 


Comment 5


Andrew Pinski



2005-01-10 19:09:18 UTC

Invalid, -M -o t, ouputs the depenciences in t.  So again this is not a bug in the compiler but in the 
makefile.


Comment 6


Jeff



2005-01-11 17:44:44 UTC

Andrew,

What compiler option flag do I need to set for forward Declartions then?  _M was
taking care of those errors however it is not producing the .o?  Is there a
Crossrefrence of compiler options between MC VC++ and GCC?


Comment 7


Andrew Pinski



2005-01-11 18:55:01 UTC

I have no idea what option you are talking about?
Look at the info/man pages of ld and gcc.


Comment 8


Jeff



2005-01-11 19:24:50 UTC

Andrew, let me try again.  BTW I have looked at the man pages for both gcc and
ld, I must say they are clear as mud, but then most are.

If I take the defaults, in CDT, I receive the errors attached below.  If I add
the options -fpreprocessed and -M as miscellaneous options, as I found in the
man pages,  the files compile without issue, but gcc does not create the proper
object files for linking.

So what gcc options would be required for forward declarations and standard
#include's?

Here is the makefile...
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

ROOT := ..

-include $(ROOT)/makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include $(SUBDIRS:%=%/subdir.mk)
-include objects.mk
-include $(DEPS)
-include $(ROOT)/makefile.defs

all: Auth.exe

Auth.exe: $(OBJS)
	@echo 'Building target: $@'
	g++  -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
	@echo 'Finished building: $@'

clean:
	-$(RM) $(OBJS) $(DEPS) Auth.exe

.PHONY: all clean dependents

-include $(ROOT)/makefile.targets



**** Full rebuild of configuration Release for project Auth ****

make -k clean all 
rm -rf     authtest.o authtestdlg.o stdafx.o       authtest.d authtestdlg.d
stdafx.d   Auth.exe
Building file: ../authtest.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -oauthtest.o ../authtest.cpp
In file included from ../authtest.cpp:4:
../AuthTest.h:4:9: warning: #pragma once is obsolete
../AuthTest.h:7:10: #error include 'stdafx.h' before including this file for PCH
In file included from ../authtest.cpp:4:
../AuthTest.h:18: error: parse error before `{' token
../AuthTest.h:29: error: ISO C++ forbids declaration of `DECLARE_MESSAGE_MAP'
with no type
../AuthTest.h: In function `int DECLARE_MESSAGE_MAP()':
../AuthTest.h:29: error: parse error before `}' token
../AuthTest.h:31:28: warning: no newline at end of file
In file included from ../authtest.cpp:5:
../AuthTestDlg.h:9: error: parse error before `{' token
../AuthTestDlg.h:17: error: parse error before `protected'
../AuthTestDlg.h:26: error: syntax error before `(' token
../AuthTestDlg.h:27: error: syntax error before `void'
../AuthTestDlg.h:28: error: syntax error before `void'
../AuthTestDlg.h:29: error: parse error before `(' token
../AuthTestDlg.h:31: error: ISO C++ forbids declaration of `DECLARE_MESSAGE_MAP'
with no type
../AuthTestDlg.h: In function `int DECLARE_MESSAGE_MAP()':
../AuthTestDlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTest.h:29: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../AuthTestDlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTest.h:29: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../AuthTestDlg.h:31: error: parse error before `public'
../AuthTestDlg.h:33: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:35: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:37: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:41: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:42: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:43: error: syntax error before `void'
../AuthTestDlg.h:44: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:45: error: parse error before `}' token
../authtest.cpp:14: error: type specifier omitted for parameter `CWinApp'
../authtest.cpp:15: error: ISO C++ forbids declaration of `BEGIN_MESSAGE_MAP'
with no type
../authtest.cpp: In function `int BEGIN_MESSAGE_MAP(CAuthTestApp)':
../authtest.cpp:15: error: `<anonymous>' has incomplete type
../AuthTest.h:17: error: forward declaration of `class CAuthTestApp'
../authtest.cpp:15: error: parse error before `(' token
../authtest.cpp:15: error: `ID_HELP' undeclared (first use this function)
../authtest.cpp:15: error: (Each undeclared identifier is reported only once for
each function it appears in.)
../authtest.cpp:15: error: `CWinApp' undeclared (first use this function)
../authtest.cpp:15: error: parse error before `::' token
../authtest.cpp:16: error: ISO C++ forbids declaration of `ON_COMMAND' with no type
../authtest.cpp: In function `int ON_COMMAND(...)':
../authtest.cpp:21: error: ISO C++ forbids declaration of `END_MESSAGE_MAP' with
no type
../authtest.cpp: In function `int END_MESSAGE_MAP()':
../authtest.cpp:22: error: invalid use of undefined type `class CAuthTestApp'
../AuthTest.h:17: error: forward declaration of `class CAuthTestApp'
../authtest.cpp: In constructor `CAuthTestApp::CAuthTestApp()':
../authtest.cpp:30: error: aggregate `CAuthTestApp theApp' has incomplete type
and cannot be defined
../authtest.cpp:35: error: syntax error before `::' token
../authtest.cpp:42: error: syntax error before `::' token
../authtest.cpp:51: error: `_T' undeclared (first use this function)
../authtest.cpp:51: error: ISO C++ forbids declaration of `SetRegistryKey' with
no type
../authtest.cpp:51: confused by earlier errors, bailing out
make: *** [authtest.o] Error 1
Building file: ../authtestdlg.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -oauthtestdlg.o ../authtestdlg.cpp
In file included from ../authtestdlg.cpp:3:
../AuthTest.h:4:9: warning: #pragma once is obsolete
../AuthTest.h:7:10: #error include 'stdafx.h' before including this file for PCH
In file included from ../authtestdlg.cpp:3:
../AuthTest.h:18: error: parse error before `{' token
../AuthTest.h:29: error: ISO C++ forbids declaration of `DECLARE_MESSAGE_MAP'
with no type
../AuthTest.h: In function `int DECLARE_MESSAGE_MAP()':
../AuthTest.h:29: error: parse error before `}' token
../AuthTest.h:31:28: warning: no newline at end of file
In file included from ../authtestdlg.cpp:4:
../AuthTestDlg.h:9: error: parse error before `{' token
../AuthTestDlg.h:17: error: parse error before `protected'
../AuthTestDlg.h:26: error: syntax error before `(' token
../AuthTestDlg.h:27: error: syntax error before `void'
../AuthTestDlg.h:28: error: syntax error before `void'
../AuthTestDlg.h:29: error: parse error before `(' token
../AuthTestDlg.h:31: error: ISO C++ forbids declaration of `DECLARE_MESSAGE_MAP'
with no type
../AuthTestDlg.h: In function `int DECLARE_MESSAGE_MAP()':
../AuthTestDlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTest.h:29: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../AuthTestDlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTest.h:29: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../AuthTestDlg.h:31: error: parse error before `public'
../AuthTestDlg.h:33: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:35: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:37: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:41: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:42: error: 'BOOL' is used as a type, but is not defined as a type.
../AuthTestDlg.h:43: error: syntax error before `void'
../AuthTestDlg.h:44: error: 'CString' is used as a type, but is not defined as a
type.
../AuthTestDlg.h:45: error: parse error before `}' token
In file included from ../authtestdlg.cpp:5:
../authtestdlg.h:8: error: declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg' in `int DECLARE_MESSAGE_MAP()' which does
not enclose `int DECLARE_MESSAGE_MAP()'
../authtestdlg.h:9: error: parse error before `{' token
../authtestdlg.h:17: error: parse error before `protected'
../authtestdlg.h:26: error: syntax error before `(' token
../authtestdlg.h:27: error: syntax error before `void'
../authtestdlg.h:28: error: syntax error before `void'
../authtestdlg.h:29: error: parse error before `(' token
../authtestdlg.h:31: error: ISO C++ forbids declaration of `DECLARE_MESSAGE_MAP'
with no type
../authtestdlg.h: In function `int DECLARE_MESSAGE_MAP()':
../authtestdlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTestDlg.h:31: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../authtestdlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTestDlg.h:31: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../authtestdlg.h:31: error: redefinition of `int DECLARE_MESSAGE_MAP()'
../AuthTest.h:29: error: `int DECLARE_MESSAGE_MAP()' previously defined here
../authtestdlg.h:31: error: parse error before `public'
../authtestdlg.h:33: error: 'CString' is used as a type, but is not defined as a
type.
../authtestdlg.h:34: error: redefinition of `int m_Product'
../AuthTestDlg.h:34: error: `int m_Product' previously declared here
../authtestdlg.h:35: error: 'CString' is used as a type, but is not defined as a
type.
../authtestdlg.h:36: error: redefinition of `int m_Vendor'
../AuthTestDlg.h:36: error: `int m_Vendor' previously declared here
../authtestdlg.h:37: error: 'BOOL' is used as a type, but is not defined as a type.
../authtestdlg.h:38: error: redefinition of `int m_Year'
../AuthTestDlg.h:38: error: `int m_Year' previously declared here
../authtestdlg.h:39: error: redefinition of `int m_Quarter'
../AuthTestDlg.h:39: error: `int m_Quarter' previously declared here
../authtestdlg.h:40: error: redefinition of `int m_Terminals'
../AuthTestDlg.h:40: error: `int m_Terminals' previously declared here
../authtestdlg.h:41: error: 'BOOL' is used as a type, but is not defined as a type.
../authtestdlg.h:42: error: 'BOOL' is used as a type, but is not defined as a type.
../authtestdlg.h:43: error: syntax error before `void'
../authtestdlg.h:44: error: 'CString' is used as a type, but is not defined as a
type.
../authtestdlg.h:45: error: parse error before `}' token
In file included from ../authtestdlg.cpp:6:
../idmach02.h:51: error: non-local function `void
id_set_info_2(DECLARE_MESSAGE_MAP()::id2_info*)' uses local type
`DECLARE_MESSAGE_MAP()::id2_info'
../idmach02.h:52: error: non-local function `void
id_get_info_2(DECLARE_MESSAGE_MAP()::id2_info*)' uses local type
`DECLARE_MESSAGE_MAP()::id2_info'
../idmach02.h:68: error: non-local function `int id_approve2(char*, char*, int*,
int, int, int*, DECLARE_MESSAGE_MAP()::id2_info*)' uses local type
`DECLARE_MESSAGE_MAP()::id2_info'
../idmach02.h:69: error: non-local function `int get_authorize2(int*, int, int,
int*, DECLARE_MESSAGE_MAP()::id2_info*)' uses local type
`DECLARE_MESSAGE_MAP()::id2_info'
../authtestdlg.cpp:8: error: non-local function `int id_test2(char*,
DECLARE_MESSAGE_MAP()::id2_info*)' uses local type `DECLARE_MESSAGE_MAP()::id2_info'
../authtestdlg.cpp:18: error: parse error before `{' token
../authtestdlg.cpp:25: error: parse error before `protected'
../authtestdlg.cpp:33: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp:17: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp: In constructor `DECLARE_MESSAGE_MAP()::CAboutDlg::CAboutDlg()':
../authtestdlg.cpp:33: error: class `DECLARE_MESSAGE_MAP()::CAboutDlg' does not
have any field named `CDialog'
../authtestdlg.cpp:33: error: incomplete type `DECLARE_MESSAGE_MAP()::CAboutDlg'
does not have member `IDD'
../authtestdlg.cpp:37: error: `CDataExchange' undeclared (first use this function)
../authtestdlg.cpp:37: error: (Each undeclared identifier is reported only once
for each function it appears in.)
../authtestdlg.cpp:37: error: `pDX' undeclared (first use this function)
../authtestdlg.cpp:38: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp:17: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp:38: error: invalid declarator
../authtestdlg.cpp:38: error: syntax error before `{' token
../authtestdlg.cpp:42: error: type specifier omitted for parameter `CDialog'
../authtestdlg.cpp:43: error: ISO C++ forbids declaration of `BEGIN_MESSAGE_MAP'
with no type
../authtestdlg.cpp:43: error: non-local function `int
BEGIN_MESSAGE_MAP(DECLARE_MESSAGE_MAP()::CAboutDlg)' uses local type
`DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp: In function `int
BEGIN_MESSAGE_MAP(DECLARE_MESSAGE_MAP()::CAboutDlg)':
../authtestdlg.cpp:43: error: `<anonymous>' has incomplete type
../authtestdlg.cpp:17: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAboutDlg'
../authtestdlg.cpp:43: error: parse error before `(' token
../authtestdlg.cpp:50: error: ISO C++ forbids declaration of `END_MESSAGE_MAP'
with no type
../authtestdlg.cpp: In function `int END_MESSAGE_MAP()':
../authtestdlg.cpp:50: error: `CWnd' undeclared (first use this function)
../authtestdlg.cpp:50: error: `pParent' undeclared (first use this function)
../authtestdlg.cpp:51: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp:51: error: invalid declarator
../authtestdlg.cpp:51: error: syntax error before `:' token
../authtestdlg.cpp:69: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp:69: error: invalid declarator
../authtestdlg.cpp:69: error: syntax error before `{' token
../authtestdlg.cpp:71: error: `m_AuthCode' undeclared (first use this function)
../authtestdlg.cpp:71: error: ISO C++ forbids declaration of `DDX_Text' with no type
../authtestdlg.cpp:71: error: initializer list being treated as compound expression
../authtestdlg.cpp:72: error: `m_MachineId' undeclared (first use this function)
../authtestdlg.cpp:72: error: ISO C++ forbids declaration of `DDX_Text' with no type
../authtestdlg.cpp:72: error: redefinition of `int DDX_Text'
../authtestdlg.cpp:71: error: `int DDX_Text' previously defined here
../authtestdlg.cpp:72: error: initializer list being treated as compound expression
../authtestdlg.cpp:73: error: ISO C++ forbids declaration of `DDX_CBIndex' with
no type
../authtestdlg.cpp:73: error: initializer list being treated as compound expression
../authtestdlg.cpp:74: error: `m_Version' undeclared (first use this function)
../authtestdlg.cpp:74: error: ISO C++ forbids declaration of `DDX_Text' with no type
../authtestdlg.cpp:74: error: redefinition of `int DDX_Text'
../authtestdlg.cpp:72: error: `int DDX_Text' previously defined here
../authtestdlg.cpp:74: error: initializer list being treated as compound expression
../authtestdlg.cpp:75: error: ISO C++ forbids declaration of `DDX_CBIndex' with
no type
../authtestdlg.cpp:75: error: redefinition of `int DDX_CBIndex'
../authtestdlg.cpp:73: error: `int DDX_CBIndex' previously defined here
../authtestdlg.cpp:75: error: initializer list being treated as compound expression
../authtestdlg.cpp:76: error: `m_Expires' undeclared (first use this function)
../authtestdlg.cpp:76: error: ISO C++ forbids declaration of `DDX_Check' with no
type
../authtestdlg.cpp:76: error: initializer list being treated as compound expression
../authtestdlg.cpp:77: error: ISO C++ forbids declaration of `DDX_CBIndex' with
no type
../authtestdlg.cpp:77: error: redefinition of `int DDX_CBIndex'
../authtestdlg.cpp:75: error: `int DDX_CBIndex' previously defined here
../authtestdlg.cpp:77: error: initializer list being treated as compound expression
../authtestdlg.cpp:78: error: ISO C++ forbids declaration of `DDX_CBIndex' with
no type
../authtestdlg.cpp:78: error: redefinition of `int DDX_CBIndex'
../authtestdlg.cpp:77: error: `int DDX_CBIndex' previously defined here
../authtestdlg.cpp:78: error: initializer list being treated as compound expression
../authtestdlg.cpp:79: error: ISO C++ forbids declaration of `DDX_Text' with no type
../authtestdlg.cpp:79: error: redefinition of `int DDX_Text'
../authtestdlg.cpp:74: error: `int DDX_Text' previously defined here
../authtestdlg.cpp:79: error: initializer list being treated as compound expression
../authtestdlg.cpp:80: error: `m_Formatter' undeclared (first use this function)
../authtestdlg.cpp:80: error: ISO C++ forbids declaration of `DDX_Check' with no
type
../authtestdlg.cpp:80: error: redefinition of `int DDX_Check'
../authtestdlg.cpp:76: error: `int DDX_Check' previously defined here
../authtestdlg.cpp:80: error: initializer list being treated as compound expression
../authtestdlg.cpp:81: error: `m_Plus' undeclared (first use this function)
../authtestdlg.cpp:81: error: ISO C++ forbids declaration of `DDX_Check' with no
type
../authtestdlg.cpp:81: error: redefinition of `int DDX_Check'
../authtestdlg.cpp:80: error: `int DDX_Check' previously defined here
../authtestdlg.cpp:81: error: initializer list being treated as compound expression
../authtestdlg.cpp:82: error: `m_Valid' undeclared (first use this function)
../authtestdlg.cpp:82: error: ISO C++ forbids declaration of `DDX_Text' with no type
../authtestdlg.cpp:82: error: redefinition of `int DDX_Text'
../authtestdlg.cpp:79: error: `int DDX_Text' previously defined here
../authtestdlg.cpp:82: error: initializer list being treated as compound expression
../authtestdlg.cpp:83: error: parse error before `}' token
../authtestdlg.cpp:85: error: type specifier omitted for parameter `CDialog'
../authtestdlg.cpp:86: error: ISO C++ forbids declaration of `BEGIN_MESSAGE_MAP'
with no type
../authtestdlg.cpp:86: error: non-local function `int
BEGIN_MESSAGE_MAP(DECLARE_MESSAGE_MAP()::CAuthTestDlg)' uses local type
`DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp: In function `int
BEGIN_MESSAGE_MAP(DECLARE_MESSAGE_MAP()::CAuthTestDlg)':
../authtestdlg.cpp:86: error: `<anonymous>' has incomplete type
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp:86: error: parse error before `(' token
../authtestdlg.cpp:87: error: ISO C++ forbids declaration of `ON_WM_SYSCOMMAND'
with no type
../authtestdlg.cpp: In function `int ON_WM_SYSCOMMAND()':
../authtestdlg.cpp:88: error: ISO C++ forbids declaration of `ON_WM_PAINT' with
no type
../authtestdlg.cpp: In function `int ON_WM_PAINT()':
../authtestdlg.cpp:90: error: ISO C++ forbids declaration of
`ON_WM_QUERYDRAGICON' with no type
../authtestdlg.cpp: In function `int ON_WM_QUERYDRAGICON()':
../authtestdlg.cpp:90: error: `OnBnClickedTest' undeclared (first use this function)
../authtestdlg.cpp:91: error: ISO C++ forbids declaration of `ON_BN_CLICKED'
with no type
../authtestdlg.cpp:91: error: initializer list being treated as compound expression
../authtestdlg.cpp:91: error: syntax error before `(' token
../authtestdlg.cpp:103: error: ISO C++ forbids declaration of `ASSERT' with no type
../authtestdlg.cpp:104: error: ISO C++ forbids declaration of `ASSERT' with no type
../authtestdlg.cpp:104: error: redefinition of `int ASSERT'
../authtestdlg.cpp:103: error: `int ASSERT' previously defined here
../authtestdlg.cpp:106: error: syntax error before `*' token
../authtestdlg.cpp:110: error: syntax error before `.' token
../authtestdlg.cpp:114: error: syntax error before `->' token
../authtestdlg.cpp:120: error: `m_hIcon' undeclared (first use this function)
../authtestdlg.cpp:120: error: `TRUE' undeclared (first use this function)
../authtestdlg.cpp:120: error: ISO C++ forbids declaration of `SetIcon' with no type
../authtestdlg.cpp:120: error: initializer list being treated as compound expression
../authtestdlg.cpp:121: error: `FALSE' undeclared (first use this function)
../authtestdlg.cpp:121: error: ISO C++ forbids declaration of `SetIcon' with no type
../authtestdlg.cpp:121: error: redefinition of `int SetIcon'
../authtestdlg.cpp:120: error: `int SetIcon' previously defined here
../authtestdlg.cpp:121: error: initializer list being treated as compound expression
../authtestdlg.cpp:125: error: parse error before `return'
../authtestdlg.cpp:128: error: `UINT' undeclared (first use this function)
../authtestdlg.cpp:128: error: parse error before `,' token
../authtestdlg.cpp:129: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp: In member function `void
DECLARE_MESSAGE_MAP()::CAuthTestDlg::OnSysCommand(...)':
../authtestdlg.cpp:130: error: `nID' undeclared (first use this function)
../authtestdlg.cpp:132: error: aggregate `DECLARE_MESSAGE_MAP()::CAboutDlg
dlgAbout' has incomplete type and cannot be defined
../authtestdlg.cpp:137: error: `CDialog' undeclared (first use this function)
../authtestdlg.cpp:137: error: parse error before `::' token
../authtestdlg.cpp:146: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp: In member function `void
DECLARE_MESSAGE_MAP()::CAuthTestDlg::OnPaint()':
../authtestdlg.cpp:147: error: `IsIconic' undeclared (first use this function)
../authtestdlg.cpp:149: error: `CPaintDC' undeclared (first use this function)
../authtestdlg.cpp:149: error: parse error before `(' token
../authtestdlg.cpp:151: error: `WM_ICONERASEBKGND' undeclared (first use this
function)
../authtestdlg.cpp:151: error: parse error before `>' token
../authtestdlg.cpp:154: error: `SM_CXICON' undeclared (first use this function)
../authtestdlg.cpp:154: error: `GetSystemMetrics' undeclared (first use this
function)
../authtestdlg.cpp:155: error: `SM_CYICON' undeclared (first use this function)
../authtestdlg.cpp:156: error: `CRect' undeclared (first use this function)
../authtestdlg.cpp:156: error: parse error before `;' token
../authtestdlg.cpp:157: error: `rect' undeclared (first use this function)
../authtestdlg.cpp:157: error: `GetClientRect' undeclared (first use this function)
../authtestdlg.cpp:162: error: `dc' undeclared (first use this function)
../authtestdlg.cpp:166: error: parse error before `::' token
../authtestdlg.cpp:172: error: syntax error before `::' token
../authtestdlg.cpp:178: error: invalid use of undefined type `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../AuthTestDlg.h:8: error: forward declaration of `class
DECLARE_MESSAGE_MAP()::CAuthTestDlg'
../authtestdlg.cpp: In member function `void
DECLARE_MESSAGE_MAP()::CAuthTestDlg::OnBnClickedTest()':
../authtestdlg.cpp:179: error: `UpdateData' undeclared (first use this function)
../authtestdlg.cpp:199: error: `LPSTR' undeclared (first use this function)
../authtestdlg.cpp:199: error: `LPCSTR' undeclared (first use this function)
../authtestdlg.cpp:199: error: parse error before `,' token
../authtestdlg.cpp:197: warning: unused variable `int AuthMask'
../authtestdlg.cpp:198: warning: unused variable `int Vendors[27]'
../authtestdlg.cpp:203: error: parse error before `,' token
../authtestdlg.cpp:213: error: `CComboBox' undeclared (first use this function)
../authtestdlg.cpp:213: error: parse error before `)' token
make: *** [authtestdlg.o] Error 1
Building file: ../stdafx.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -ostdafx.o ../stdafx.cpp
Finished building: ../stdafx.cpp
 
make: Target `all' not remade because of errors.
Build complete for project Auth


Comment 9


Andrew Pinski



2005-01-11 19:31:39 UTC

This is your bug and not gcc bug, figure out why you are getting the following error:
../AuthTest.h:7:10: #error include 'stdafx.h' before including this file for PCH

The reason why it works just fine for -M, well it does not fully compile, it only emits the dependencies.

Andrew,

If I take the exact same code, and compile it with VC++ it does not complain! 
However, gcc the ONLY thing that has changed, will not compile code that works!

Why? Old wise one, must one rewrite entrie working applications just so gcc
understands??


Comment 11


Andrew Pinski



2005-01-11 20:07:08 UTC

../AuthTest.h:7:10: #error include 'stdafx.h' before including this file for PCH

See that error, in VC++ (which is not usually a compand line driven) you have a PCH which use, do "-
include stdafx.h" on the command for gcc since that is actually done for you with VC++, this is still not 
a gcc problem, please stop reopening this bug as it is not a gcc bug and cannot be.

Andrew,

You are sure hard to convince...

Where did the error go?


**** Full rebuild of configuration Release for project Auth ****

make -k clean all 
rm -rf     authtest.o authtestdlg.o stdafx.o       authtest.d authtestdlg.d
stdafx.d   Auth.exe
Building file: ../authtest.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -fpreprocessed -M -oauthtest.o ../authtest.cpp
Finished building: ../authtest.cpp
 
Building file: ../authtestdlg.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -fpreprocessed -M -oauthtestdlg.o ../authtestdlg.cpp
Finished building: ../authtestdlg.cpp
 
Building file: ../stdafx.cpp
g++ -IC:Documents and SettingsjeffDesktopAuthTestinclude -O3 -Wall -c
-fmessage-length=0 -fpreprocessed -M -ostdafx.o ../stdafx.cpp
Finished building: ../stdafx.cpp
 
Building target: Auth.exe
g++  -o Auth.exe     authtest.o authtestdlg.o stdafx.o    
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:authtest.o:
file format not recognized; treating as linker script
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:authtest.o:1:
syntax error
collect2: ld returned 1 exit status
make: *** [Auth.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project Auth


Comment 13


Andrew Pinski



2005-01-11 20:26:35 UTC

Considering -M does not actually compile your code, no I am not hard to convince.
Read the manual for gcc and you will see -M does not compile the code at all, only gets the dependices 
for include files.


Comment 14


David Edelsohn



2005-01-11 20:29:21 UTC

Jeff,

The problem does not have to be the source code or the compiler, it can be the
way that you are invoking the compiler.  I do not understand why you are
invoking the compiler with -M -fpreprocessed -- you say that with those options
it works, but it obviously does not work.  I infer that you mean it works
because you no longer receive error messages, but that change in behavior is a
byproduct of the option not because those options are necessary or correct.  You
are skipping the compiler processing that produces the error messages *and*
skipping the compiler processing that produces an object file.

David

Those additional options are wrong.  You need to figure out how to address the
error messages.  If the application source code is standard C++, it should
compile with both VC++ and with G++, modulo problems with conformance to standards.

As best I can figure out from the discussion thread, VC++ is being "friendly"
and implicitly inserting some header files that should be referenced explicitly.
 This is a difference in behavior between the two compilers, not a bug in either
one.  However, you need to adapt your source code and your build machinery to
the behavior of each compiler.

Well that makes sense..

Does anyone have an example of the compiler options to port from VC++ to GCC?  A
nice Crossreference table would be just dandy.


Comment 16


Andrew Pinski



2005-01-11 21:14:17 UTC

Well open a new bug for that and/or figure out what the options do, all of the gcc options are 
documented and if they are not, then that is a bug.

Member Avatar

9 Years Ago

hi.
i have written a program in c and also a makefile for it but i have a repetitive error:
/usr/bin/ld:4.txt: file format not recognized; treating as linker script
/usr/bin/ld:4.txt:1: syntax error

here is makefile code:

CC=gcc
test2 : test2.c 
        $(CC) test2.c 4.txt 5.txt 6.txt -I -lpthread -lrt -o test2

Edited

9 Years Ago
by fafa70


Recommended Answers

All 3 Replies

Member Avatar


deceptikon

1,790



Code Sniper



Administrator



Featured Poster


9 Years Ago

What are 4.txt, 5.txt, and 6.txt?

Member Avatar

9 Years Ago

names of files that test2.c will use information inside of them and are beside of test2.c
i tested -I for showing this but didn’t work.

Edited

9 Years Ago
by fafa70

Member Avatar


deceptikon

1,790



Code Sniper



Administrator



Featured Poster


9 Years Ago

If they’re data files, why are you trying to compile them?


Reply to this topic

Be a part of the DaniWeb community

We’re a friendly, industry-focused community of developers, IT pros, digital marketers,
and technology enthusiasts meeting, networking, learning, and sharing knowledge.

Whenever I type in g++ toe.ccp this comes up:

/usr/bin/ld:toe.ccp: file format not recognized; treating as linker script
/usr/bin/ld:toe.ccp:1: syntax error
collect2: ld returned 1 exit status

Dan's user avatar

Dan

6,6755 gold badges24 silver badges43 bronze badges

asked Jun 2, 2014 at 19:44

FukDuk's user avatar

It appears you have the wrong file extension. You created a file which you called toe.ccp, however what you want is a file that is toe.cpp (Two p’s, not two c’s in your file extension). Renaming the file will cause g++ to work correctly.

In case you are unfamiliar with how to do so on the command line, you can do

mv toe.ccp toe.cpp

in the terminal to rename the file. Then try compiling it with g++, it should now work.

Eliah Kagan's user avatar

Eliah Kagan

115k52 gold badges310 silver badges482 bronze badges

answered Jun 2, 2014 at 19:53

MaxML's user avatar

MaxMLMaxML

2111 silver badge5 bronze badges

1

You should use the correct file extension for the program. toe.ccp is not recognized by GCC as a source file format because of the file extension, so it doesn’t know what to do with it. You probably meant to save your file as toe.cpp instead.

As shown in the GCC user manual section on input file names, there are a predefined list of file extensions for each recognized programming language. C++ source files can end in .cc, .cp, .cxx, .cpp, .CPP, .c++, or .C.

answered Jun 2, 2014 at 19:53

Michael Miller's user avatar

Michael MillerMichael Miller

4,5311 gold badge24 silver badges41 bronze badges

Модератор: Модераторы

Поиогите решить 2 проблемы при переходе на FPC

Пытаюсь перейти с Delphi на FPC, но тормозят две проблемы:

1. При компилировании из IDE FPC возникает следующая ошибка:

Error: could not create d:turbidprogram.exe

Error: ld.exe:link.res: file format not recognized; treating as linker script

Error: ld.exe:link.res:1: syntax error

Если убрать галочку с параметра «Call linker after», то ошибка меняется на «Error while linking». При компилировании из командной строки ошибки не возникает.

2. При использовании некоторых функций из модуля ShellApi (Shell_NotifyIcon, ExtractIcon), находящегося в папке winunits возникает следующая ошибка: «Can’t determine which overloaded function to call».

Turbid
новенький
 
Сообщения: 11
Зарегистрирован: 23.05.2006 01:49:23

Сообщение Sergei I. Gorelkin » 24.05.2006 09:15:15

По второму пункту — надо явно указывать типы аргументов:

Код: Выделить всё
var
  sfos: TSHFileOpStructA;
begin
  ...
  result := (0 = ShFileOperation(LPSHFileOpStructA(@sfos))) and (not sfos.fAnyOperationsAborted);
  ...

Это происходит потому, что функции объявлены с передачей параметов по указателю, а оператор @ по умолчанию дает нетипизированный указатель (Pointer).

Аватара пользователя
Sergei I. Gorelkin
энтузиаст
 
Сообщения: 1389
Зарегистрирован: 24.07.2005 14:40:41
Откуда: Зеленоград
  • Профиль
  • ICQ

Сообщение alexs » 24.05.2006 10:17:16

аналогичная первой ошибке была у меня — методом проб и ошмбок выяснил — что не линкуется еслив имени каталога есть восклицательный знак — может у тебя тоже что-то не так?

посмотри какой получается bat файл на линковку после работы FPC.

поробуй собрать в другом каталоге

Аватара пользователя
alexs
долгожитель
 
Сообщения: 4009
Зарегистрирован: 15.05.2005 23:17:07
Откуда: г.Ставрополь
  • Профиль
  • Сайт
  • ICQ

Сообщение Replicator » 24.05.2006 12:44:44

И из-за пробелов в имени тоже могут быть проблемы.

Replicator
постоялец
 
Сообщения: 154
Зарегистрирован: 30.04.2006 17:14:45
Откуда: Outer Heaven
  • Профиль
  • Сайт
  • ICQ

Re: Поиогите решить 2 проблемы при переходе на FPC

Сообщение Илья Аввакумов » 24.05.2006 13:08:32

Turbid писал(а):Error: could not create d:turbidprogram.exe
Error: ld.exe:link.res: file format not recognized; treating as linker script
Error: ld.exe:link.res:1: syntax error

Ни пробелов, ни знаков препинания в имени каталога здесь вроде нет. А на link.res взглянуть-то можно?

Илья Аввакумов
новенький
 
Сообщения: 50
Зарегистрирован: 04.05.2005 15:06:42
Откуда: Екатеринбург

Сообщение Replicator » 24.05.2006 13:24:59

При компилировании из командной строки ошибки не возникает.

Так что проблема не в link.res. А, может, дать другое имя файлу ресурсов?

И еще, у меня иногда возникают проблемы с ресурсами, ошибку точно не помню. Но решаются они компилированием ресурса в объектный файл и линкованием его по {$L resource.o}

Replicator
постоялец
 
Сообщения: 154
Зарегистрирован: 30.04.2006 17:14:45
Откуда: Outer Heaven
  • Профиль
  • Сайт
  • ICQ

Сообщение Turbid » 24.05.2006 15:37:23

Действительно, первая ошибка возникала из-за «!» в имени папки (надеюсь это исправят) — здесь я привел произвольную паку в качестве примера, как оказывается зря.

А на счет второй суть понял и разобрался:

Код: Выделить всё
type
  LPNOTIFYICONDATA = ^NOTIFYICONDATA;
var
  IconData: NOTIFYICONDATA;
...
Shell_NotifyIcon(NIM_ADD, LPNOTIFYICONDATA(@IconData));

Но почему в Delphi прокатывало без этого?

Turbid
новенький
 
Сообщения: 11
Зарегистрирован: 23.05.2006 01:49:23

Сообщение Sergei I. Gorelkin » 24.05.2006 17:24:02

Дельфи начал поддерживать перегрузку ф-ций начиная с четвертой версии, а когда начал, никто готовые модули переписывать не захотел.

Поэтому там ф-ции API, имеющие ANSI и UNICODE варианты, объявлены без перегрузки. Т.е. в нашем примере есть Shell_NotifyIconA, Shell_NotifyIconW и еще просто Shell_NotifyIcon, которая в точности соответствует Shell_NotifyIconA.

FreePascal же поддерживал перегрузку, наверное, с самого начала, поэтому там ANSI и UNICODE ф-ции объявлены с одинаковыми именами и разными аргументами. Другое дело, что, по-хорошему, нужно параметр, который не может принимать значение nil, передавать не по указателю, а по ссылке (т.е. procedure foo(var a: bar)) — тогда у компилятора не будет проблемы с опознанием типа параметов. Впрочем, в модуле Windows это уже на 99% сделано, а до WinUnits пока руки у разработчиков не дошли…

Аватара пользователя
Sergei I. Gorelkin
энтузиаст
 
Сообщения: 1389
Зарегистрирован: 24.07.2005 14:40:41
Откуда: Зеленоград
  • Профиль
  • ICQ

Сообщение Turbid » 25.05.2006 12:59:03

2Sergei I. Gorelkin: Спасибо что помогли разобраться.

Turbid
новенький
 
Сообщения: 11
Зарегистрирован: 23.05.2006 01:49:23

Сообщение Turbid » 08.11.2006 00:55:38

Ну вот, еще одна проблема: в модуле mmsystem не можем найти функцию:

Код: Выделить всё
Mixer.pp(113,5) Error: Identifier not found "mixerSetControlDetails"
Mixer.pp(113,76) Error: Illegal expression
Mixer.pp(162,5) Error: Identifier not found "mixerSetControlDetails"
Mixer.pp(162,76) Error: Illegal expression
Mixer.pp(167) Fatal: There were 4 errors compiling module, stopping
Mixer.pp(8,28) Fatal: Compilation aborted
Error: C:FPC2.0.4bini386-Win32ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

Причем с mixerGetControlDetails все в порядке. Может она есть, но под другим именем? В общем складывается ощущение, что нормально под WinApi писать не можется…

p.s. FPC 2.0.4

Turbid
новенький
 
Сообщения: 11
Зарегистрирован: 23.05.2006 01:49:23

Сообщение Sergei I. Gorelkin » 08.11.2006 12:35:39

Мда, объявления этой функции натурально нет… Причем нет даже в JEDI API Library (packages/extra/winunits/). Но что мешает самому объявить? Вопрос одной лишней строчки…

Аватара пользователя
Sergei I. Gorelkin
энтузиаст
 
Сообщения: 1389
Зарегистрирован: 24.07.2005 14:40:41
Откуда: Зеленоград
  • Профиль
  • ICQ

Сообщение Иван Шихалев » 09.11.2006 09:01:40

Turbid писал(а):первая ошибка возникала из-за «!» в имени папки (надеюсь это исправят)

Не исправят — проблема не в FPC, а в компоновщике ld.

Аватара пользователя
Иван Шихалев
энтузиаст
 
Сообщения: 1138
Зарегистрирован: 15.05.2006 11:26:13
Откуда: Екатеринбург
  • Профиль
  • Сайт

Сообщение SergKam » 09.11.2006 16:30:17

значит всетаки исправят. компоновщик в винде уже свой внутренний,

навкрняка там такого бага нет

SergKam
постоялец
 
Сообщения: 251
Зарегистрирован: 16.11.2005 21:31:11
Откуда: Украина,Харьков

Сообщение Turbid » 23.04.2007 23:12:11

Снова проблема с программированием под WinApi.

Каким образом я должен был догадаться, что вместо DllProc (как в Delphi) я должен использовать Dll_Process_Attach_Hook и компанию. Хорошо, что случайно нашел ответ здесь: http://freepascal.ru/forum/viewtopic.php?t=1040&highlight=dllprocessattachhook, и то, совершенно случайно.

Поиск этого дела в документации ни к чему не привел. Вопрос: где о подобных отличиях почитать подробно, иначи еще такие грабли не выдержу.

Turbid
новенький
 
Сообщения: 11
Зарегистрирован: 23.05.2006 01:49:23

Сообщение Sergei I. Gorelkin » 24.04.2007 02:35:45

Turbid писал(а):Поиск этого дела в документации ни к чему не привел. Вопрос: где о подобных отличиях почитать подробно, иначи еще такие грабли не выдержу.

Чтобы об этом прочитать, нужно сначала чтобы кто-то написал. А чтобы написать о граблях, надо сначала на них наступить. Так что пока — нравится нам это или нет — самым достоверным источником информации являются исходники…

Аватара пользователя
Sergei I. Gorelkin
энтузиаст
 
Сообщения: 1389
Зарегистрирован: 24.07.2005 14:40:41
Откуда: Зеленоград
  • Профиль
  • ICQ


Вернуться в Free Pascal Compiler

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 5

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • File exists or the failure is unspecified xerox 3345 ошибка сканирования
  • File exists or the failure is unspecified xerox 3335 ошибка сканирования