User forums => General (but related to Code::Blocks) => Topic started by: accelas on October 07, 2005, 01:42:11 am

Title: VC++?
Post by: accelas on October 07, 2005, 01:42:11 am
I'm using Code::blocks w/ VC++ toolkit, (since it's the only free ide, which supposed to work out of the box w/ VC++ tk).

Well, I'm trying to compile the test example come with libusb-win32. VC++ linker gives me a strange error (admittedly, C/C++ isn't my thing, i do most work with assembly on MCU's), that the function snprintf isn't found. After googling around I found that snprintf is a part of standard C lib, meaning it should be included in libc.lib, which in fact is in my lib search path. When I tried to change libc.lib to another location/version. It gave me the same error plus few more.

I uses standard compiling command come with Code:Block as below

Code: [Select]
link.exe /nologo    /LIBPATH:"C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib" /LIBPATH:"C:\Program Files\Microsoft Platform SDK\Lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib" /LIBPATH:"C:\Program Files\Microsoft.NET\SDK\v1.1\Lib" /out:"C:\Documents and Settings\accelas\Desktop\project\console.exe"    "C:\Documents and Settings\accelas\Desktop\project\lib\msvc\libusb.lib" .objs\testlibusb.obj
Does anyone have some ideas?
Title: Re: VC++?
Post by: sethjackson on October 07, 2005, 01:49:17 am
You have created a project right?

To use snprintf()

you need to do this

Code: [Select]
#include <stdio.h>
#include <stdlib.h>

It is in one of those headers not sure which one because I don't use C functions very much (mainly becuase I use C++).
Title: Re: VC++?
Post by: mandrav on October 07, 2005, 08:41:35 am
VC++ linker gives me a strange error

And the strange error is???
Title: Re: VC++?
Post by: zieQ on October 07, 2005, 09:26:02 am
And libc (or another lib with the c standard functions) is automatically included by the linker, no need to worry about putting it to the linker options.
Want to see the linker errror too, since VC++ lacks some libraries (multi-threaded...) :wink: