Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: pjmavcom on November 08, 2007, 03:29:53 am

Title: #pragma comment
Post by: pjmavcom on November 08, 2007, 03:29:53 am
Hi. New to C::B here, but I find it pretty impressive so far. Ive been working in VC++ for a while and Ive been using
Code
#pragma comment(lib, "ddraw.lib")
and
Code
#pragma comment(lib, "dxguid.lib")
so I dont have to add the files to every project I make. Copying these files into C::B now it throws out a warning saying its ignoring #pragma statements.
How could I get around this, and enable the use of those #pragma statements? Or where would I need to go to add these files to the project?
Thanks in advance.
Title: Re: #pragma comment
Post by: stahta01 on November 08, 2007, 04:56:02 am
What compiler are you using?
I think those pragmas only works on MSVC.

Tim S
Title: Re: #pragma comment
Post by: pjmavcom on November 08, 2007, 12:36:21 pm
Im using the GCC compiler. Ill try the MSVC compiler after work and see. I thought it mightve been something to do with the files the project needs to know about. In MSVC you can add these libs in the project properties somewhere. Thats kinda what I was looking for in C::B. Or an alternative to #pragma. Thanks for the tip.
Title: Re: #pragma comment
Post by: stahta01 on November 08, 2007, 02:30:25 pm
I am guessing that the comment pragma just adds the libraries. Under C::B adding Libraries is done like this.

Project -> Build Options
Tab "Linker Settings"
Try adding the Libraries under "Link Libraries"

I would try the names of listed below, GCC does not use .lib extension, and see if they work.
ddraw
dxguid


Tim S
Title: Re: #pragma comment
Post by: thomas on November 08, 2007, 02:37:19 pm
This is non-standard stuff only supported by MSVC. Using that compiler is the only way to make it work.
Title: Re: #pragma comment
Post by: pjmavcom on November 09, 2007, 02:30:57 am
Hey thanks stahta01. Thats what I was looking for, where to add the libraries. Its all working now.
Is there any kind of code I can add to this file to make GCC add those libraries like that #pragma comment line does in MSVC? If not thats cool, Ill just have to remember where to add those when I need to again.