User forums > Using Code::Blocks
Complete solution found for Borland C++ 5.5 linkage errors
Greatwolf:
It's true compiled resources can't be passed to the linker in this fashion. The method of using #pragma works perfectly fine as far as I could tell and that's the method I use whenever I need to link resources into my program. I found it to be the most straight forward way of doing it.
What I have done is put the #pragma resource line in the resource.h header file. It doesn't seem like the linker minds having multiple reference to link the same resource file:
//resource.h
--- Code: ---#ifndef __RESOURCE_H__
#define __RESOURCE_H__
#define APPICON 1
#pragma resource "resource.res"
#endif
--- End code ---
//resource.rc
--- Code: ---#include "resource.h"
APPICON ICON "sample.ico"
--- End code ---
//main.cpp
--- Code: ---#include "resource.h"
using namespace std;
//or WinMain if it's windows GUI app
int main()
{
//code that does something useful goes here
return 0;
}
--- End code ---
Hope that helps
emanahmed:
thanks alot for help
StevePRGM:
Supposedly, this isn't supposed to be in this forum (Reason: post is about compiler issues)
Here's links to forums for Borland compiler information (which i have found after searching)
about #pragma | DaniWeb
http://www.daniweb.com/software-development/cpp/threads/8862/about-pragma
Borland pragma to add a library - DevX.com Forums
http://forums.devx.com/showthread.php?t=92861
PS.
Note: I have referenced this in forums.devx.com as a place for information about the Borland compiler..
Navigation
[0] Message Index
[*] Previous page
Go to full version