Author Topic: #pragma comment  (Read 32786 times)

pjmavcom

  • Guest
#pragma comment
« 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: #pragma comment
« Reply #1 on: November 08, 2007, 04:56:02 am »
What compiler are you using?
I think those pragmas only works on MSVC.

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

pjmavcom

  • Guest
Re: #pragma comment
« Reply #2 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: #pragma comment
« Reply #3 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: #pragma comment
« Reply #4 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

pjmavcom

  • Guest
Re: #pragma comment
« Reply #5 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.