Author Topic: How to use pragma for adding resources in codeblocks?  (Read 12323 times)

Offline bobsadino

  • Multiple posting newcomer
  • *
  • Posts: 10
How to use pragma for adding resources in codeblocks?
« on: March 09, 2018, 03:18:26 pm »
on the linker setting we can choose to add library

what is the equivalent of doing this by writing pragma?

i have tried #pragma comment(lib, object.o)

but it doesnt work But, if i add object from linker setting it's compiled successfully. So i want to know what are the flags. So i can add object  thru the  source code file by writing pragma.

windows7
CB 16.07

build log:
main.obj||fatal error LNK1276: invalid directive 'F:\mnr\resource.o' found; does not start with '/'|
« Last Edit: March 09, 2018, 03:25:16 pm by bobsadino »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: How to use pragma for adding resources in codeblocks?
« Reply #1 on: March 09, 2018, 04:49:21 pm »
#pragma is a compiler directive

codeblocks is not a compiler

If you are using the default installation you are probably using gcc for compilation. gcc does not support this pragmas: https://gcc.gnu.org/onlinedocs/gcc/Pragmas.html

you have to use the msvc compiler to be able to use this kind of pragmas. You can use the msvc compiler within codeblocks if you want...

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: How to use pragma for adding resources in codeblocks?
« Reply #2 on: March 09, 2018, 04:51:42 pm »
I see, you are using the msvc...
sadly i do not know anything about this compiler...
did you looked for this:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/6a314b3a-8165-4338-9646-a65844646a55/fatal-error-lnk1276-does-not-start-with-?forum=vclanguage

Jency

  • Guest
Re: How to use pragma for adding resources in codeblocks?
« Reply #3 on: July 19, 2019, 09:48:55 am »
I am unable to run pragma on codeblock

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: How to use pragma for adding resources in codeblocks?
« Reply #4 on: July 19, 2019, 11:11:05 am »
#pragma is a compiler directive

codeblocks is not a compiler