LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2009, 07:39 PM   #1
Kunsheng
Member
 
Registered: Mar 2009
Posts: 82

Rep: Reputation: 16
'CFlAGS' in Visual Studio ?


Hi everyone,

I am trying to link a static libcurl.lib file in Visual Studio 6 but It was not working.

I checked a little bit online and it said I have to add '-DCURL_STATICLIB' to the 'CFLAGS' when compiling in Windows. I know that should be contained in a Makefile if it is Linux. However I have no idea how a Visual C++ is dealing with that CFLAGS there. Is there any place I could modify before 'Build' the executable ?


I only use 'Build' function in VC so far for any compilation.



Any idea is well appreciated,

Thanks,

-Kun
 
Old 06-02-2009, 07:48 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

1. If you're using the Visual Studio IDE, then:
a) Select your project
b) <Right-cick>, Settings,
[C++] tab,
"Preprocessor" category (drop-down list),
c) add "CURL_STATICLIB" to the list

2. If you've got a Makefile, then just add "/DCUR_STATICLIB" to the compile line.

'Hope that helps .. PSM

PS:
"CFLAGS" is just a generic term for "C/C++ compiler flags"
 
Old 06-02-2009, 08:28 PM   #3
Kunsheng
Member
 
Registered: Mar 2009
Posts: 82

Original Poster
Rep: Reputation: 16
Thanks, Paulsm. The compiler could find the *.lib file now.

Yet there are tons of errors there:
-------------------------------------------------------

Compiling...
main.cpp
Linking...
LIBCMT.lib(tolower.obj) : error LNK2005: __tolower already defined in LIBCD.lib(tolower.obj)
LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in LIBCD.lib(tolower.obj)
LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in LIBCD.lib(getenv.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
libcurl.lib(easy.obj) : error LNK2001: unresolved external symbol __imp__WSACleanup@0
libcurl.lib(easy.obj) : error LNK2001: unresolved external symbol __imp__WSAStartup@8
libcurl.lib(md5.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcurl.lib(netrc.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcurl.lib(http_digest.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcurl.lib(parsedate.obj) : error LNK2001: unresolved external symbol ___security_cooki

----------------------------------------------------------------------


Did you meet this before ? I am using Visual C++ 6.0, my program is nothing more than using some curl_easy routines there.


Also I downloaded that static lib online, only with two files: curl/curl.h file and libcurl.lib.


Anyway it is linked, Thanks a lot!

-Kun






Quote:
Originally Posted by paulsm4 View Post
Hi -

1. If you're using the Visual Studio IDE, then:
a) Select your project
b) <Right-cick>, Settings,
[C++] tab,
"Preprocessor" category (drop-down list),
c) add "CURL_STATICLIB" to the list

2. If you've got a Makefile, then just add "/DCUR_STATICLIB" to the compile line.

'Hope that helps .. PSM

PS:
"CFLAGS" is just a generic term for "C/C++ compiler flags"
 
Old 06-02-2009, 08:54 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

WSAStartup and friends are in Winsock (the Windows networking library). Add ws2_32.lib to your link command.

Other than that, I'm not sure.

Last edited by paulsm4; 06-02-2009 at 09:35 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid Question: Microsoft Visual Studio 6.0 (A.K.A. Visual Basic 6) Will it run? S0RD3N Linux - Software 8 05-07-2008 08:42 PM
GCC vs VISUAL STUDIO paragkalra Linux - Software 1 01-05-2007 01:21 AM
Visual Studio like IDE jpc82 Programming 6 02-13-2004 06:12 AM
Weaning myself from Visual Studio kleptophobiac Programming 2 01-25-2004 10:44 AM
Is Visual Studio in Linux??? rob99 Linux - Software 6 01-22-2003 04:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration