News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

#pragma comment

Started by pjmavcom, November 08, 2007, 03:29:53 AM

Previous topic - Next topic

pjmavcom

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 #pragma comment(lib, "ddraw.lib") and #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.

stahta01

What compiler are you using?
I think those pragmas only works on MSVC.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

pjmavcom

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.

stahta01

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
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

thomas

This is non-standard stuff only supported by MSVC. Using that compiler is the only way to make it work.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

pjmavcom

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.