Linking a MS obj file in Dev-C++

Programming, for all ages and all languages.
Post Reply
chris
Posts: 5
Joined: Fri Sep 05, 2008 7:22 am

Linking a MS obj file in Dev-C++

Post by chris »

I'm trying to link a MS static obj file in Dev-C++ and it results in the following link error:
.drectve `-defaultlib:uuid.lib ' unrecognized
With some googling I found this answer:
From: Filip Navara
Re: Re: [Mingw-users] Warning: .drectve `%.*s" unrecognized
2003-11-12 12:24
This is directive that MSVC puts in object files
to tell the linker to link with particular library.
You can safely ignore this and pass the correct
libraries on command line (or in makefile, ...).
Example: /DEFAULTLIB:"uuid.lib"
has equivalent -luuid in GCC.
I have added "-luuid" to my makefile.win as so:

EDIT: adding libuuid to the project library list doesn't change the file size either.

Code: Select all

[...]
LIBS =  -L"C:/Dev-Cpp/lib" C:/Anritsu_BER_Tester/Gpib-32.obj  

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "BER.exe" -luuid $(LIBS)
[...]
However, after compiling I noticed the file size of the exe is 48 kb from Dev-C++ and 237 kb from MSVC. Does this indicate something is still wrong? At this moment I don't have access to the equipment necessary to run this software. EDIT: Going to try to get the equipment today to test this.

Thanks
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Linking a MS obj file in Dev-C++

Post by bewing »

-luuid may not be enough.
Yes, the difference in size could indicate a problem, but MSVC does add a lot of overhead to executables, beyond just the code, so it's hard to tell.
But the point is that you might need to specify a full pathname to the MSVC uuid library -- hopefully your other compiler can read the format. Your other compiler might not even HAVE a uuid library.
chris
Posts: 5
Joined: Fri Sep 05, 2008 7:22 am

Re: Linking a MS obj file in Dev-C++

Post by chris »

* Btw I did also try adding libuuid in the project menu of Dev-Cpp with the same result (same file size), as indicated in my edit of the OP

Dev-Cpp does indeed have libuuid in it's library directory and if I pass something like "-ljhsdjfhsdf" to gcc it complains that it doesn't exists, so I know it is at least checking that libuuid exists when compiling.

I will try your idea of linking with the MSVC libuuid.

Thanks
chris
Posts: 5
Joined: Fri Sep 05, 2008 7:22 am

Re: Linking a MS obj file in Dev-C++

Post by chris »

Adding the MSVC uuid library via the project menu didn't change the file size. A portion of the generated makefile looks like this:

Not sure if this helps but here is the makefile it generated:

Code: Select all

# Project: BER
# Makefile created by Dev-C++ 4.9.9.2

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = C:/Anritsu_BER_Tester/gpib_driver.o C:/Anritsu_BER_Tester/BER_earlypass.o C:/Anritsu_BER_Tester/BER_wcdma_test.o C:/Anritsu_BER_Tester/test.o $(RES)
LINKOBJ  = C:/Anritsu_BER_Tester/gpib_driver.o C:/Anritsu_BER_Tester/BER_earlypass.o C:/Anritsu_BER_Tester/BER_wcdma_test.o C:/Anritsu_BER_Tester/test.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib" C:/Anritsu_BER_Tester/Gpib-32.obj  "C:/Program Files/Microsoft Visual Studio/VC98/Lib/UUID.LIB"  
INCS =  -I"C:/Dev-Cpp/include" 
CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include" 
BIN  = BER.exe
CXXFLAGS = $(CXXINCS)  
CFLAGS = $(INCS)  
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before BER.exe all-after


clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "BER.exe" $(LIBS)

C:/Anritsu_BER_Tester/gpib_driver.o: C:/Anritsu_BER_Tester/gpib_driver.c
	$(CC) -c C:/Anritsu_BER_Tester/gpib_driver.c -o C:/Anritsu_BER_Tester/gpib_driver.o $(CFLAGS)

C:/Anritsu_BER_Tester/BER_earlypass.o: C:/Anritsu_BER_Tester/BER_earlypass.c
	$(CC) -c C:/Anritsu_BER_Tester/BER_earlypass.c -o C:/Anritsu_BER_Tester/BER_earlypass.o $(CFLAGS)

C:/Anritsu_BER_Tester/BER_wcdma_test.o: C:/Anritsu_BER_Tester/BER_wcdma_test.c
	$(CC) -c C:/Anritsu_BER_Tester/BER_wcdma_test.c -o C:/Anritsu_BER_Tester/BER_wcdma_test.o $(CFLAGS)

C:/Anritsu_BER_Tester/test.o: C:/Anritsu_BER_Tester/test.c
	$(CC) -c C:/Anritsu_BER_Tester/test.c -o C:/Anritsu_BER_Tester/test.o $(CFLAGS)
Post Reply