QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 9424|回复: 4
打印 上一主题 下一主题

[问题求助] C++调用lingo

[复制链接]
字体大小: 正常 放大

4

主题

3

听众

18

积分

升级  13.68%

该用户从未签到

跳转到指定楼层
1#
发表于 2011-5-23 12:06 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
本帖最后由 tomorrow0530 于 2011-5-23 12:07 编辑
$ Y& w! X% m! S! P  Z1 _2 ?- u" [) ^2 t+ q4 n3 x
现需要c++来调用lingo文件
1 N' s8 h/ i& l" ]) m我用lingo目录下C:\LINGO11\Programming Samples\VC++\**自带的文件,
" d* G1 R3 C9 v6 i* T* j& x; K/ E新建了一个工程,' T* n2 R1 S0 {2 L5 H2 i
然后**.c文件加入工程,
. s8 t2 y4 u; }9 E) J5 e* y, r8 {然后再把lingo11.lib添加到工程中,
$ t& o, G, h, |1 p3 W6 ]4 k: K- a
但是编译报错!: H2 Z" ?, Y* l4 f$ ]
直接编译报:
, m( M; Z2 @) a75 C:\LINGO11\Programming Samples\VC++\**\**.c invalid conversion from `int (*)(void*, void*, int, char*)' to `void (*)(void*, void*, int, char*)'
, ~" J8 O9 r! r/ T$ ^; _75 C:\LINGO11\Programming Samples\VC++\**\**.c   initializing argument 2 of `int LSsetCallbackErrorLng(void*, void (*)(void*, void*, int, char*), void*)' / W4 S+ L6 p4 y+ v! ~% ]6 p% l

0 P# i0 l. O* K  i* q用**目录下的makefile文件编译报:
( E/ \! ]# Q- L  CreateProcess((null), cl -c **.c, ...) failed. + f$ n7 E  Z3 m" O5 ]) C, E# @
  系统找不到指定的文件。
: G9 R6 m. R6 f3 n! ~2 L* FC:\LINGO11\Programming Samples\VC++\**\Makefile [Build Error]  [**.obj] Error 2
5 ~/ F2 {9 n, K4 H$ b我用的C++编译器是devC++4.9.9.2: K) M. M( u  O- P  C
有人成功过吗?
4 J' `8 b# q2 [0 j2 t0 \
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信

4

主题

3

听众

18

积分

升级  13.68%

该用户从未签到

本帖最后由 tomorrow0530 于 2011-5-23 12:08 编辑 , Z" o/ ~7 B- h- W& ?

. C) N, {, j9 s( b! G) [8 ]为什么我输入了s i m p l e变成**了
回复

使用道具 举报

4

主题

3

听众

18

积分

升级  13.68%

该用户从未签到

在直接编译下我把75行的注释后,编译没有错了,但是链接出错了,说明还是没有链接成功
# Q) G4 I8 @% m# y提示
( h0 u! N7 l2 v* lCompiler: Default compiler# [5 T" G8 g* g* c/ s$ @
Building Makefile: "C:\LINGO11\Programming Samples\C++\**\Makefile.win"; e6 p. U  G, _2 \
Executing  make.../ e+ j' _4 z+ a" ~- `4 V6 K$ Z- i8 @
make.exe -f "C:\LINGO11\Programming Samples\C++\**\Makefile.win" all  J0 J, M' j/ n6 r4 T$ N% p
g++.exe **.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib"   
! v; |8 r  l7 ^& _+ V  {; H
: o- L: `1 w8 n+ |; l4 Y& E**.o(.text+0x15c):**.c: undefined reference to `LScreateEnvLng@0'
/ Q/ w  L- D2 q( U% X+ B. K**.o(.text+0x1a6):**.c: undefined reference to `LSsetCallbackSolverLng@12'- A% A+ Z1 Q. A/ G
**.o(.text+0x1eb):**.c: undefined reference to `LSopenLogFileLng@8'9 ?/ g+ y4 i. W9 B. E6 S
**.o(.text+0x224):**.c: undefined reference to `LSsetPointerLng@12'* C; w7 }, e+ f3 }3 S! H& @
**.o(.text+0x25d):**.c: undefined reference to `LSsetPointerLng@12'0 ]& A/ \- f- r5 H
**.o(.text+0x296):**.c: undefined reference to `LSsetPointerLng@12'! b2 J( z  a: q9 i9 Q
**.o(.text+0x2cf):**.c: undefined reference to `LSsetPointerLng@12'# ~! q4 b) V) f8 F
**.o(.text+0x308):**.c: undefined reference to `LSsetPointerLng@12') C" E7 c$ [" Z2 D6 v0 I; b- z- t+ M7 J
**.o(.text+0x341):**.c: more undefined references to `LSsetPointerLng@12' follow  H! e/ z- Z. @0 i6 [
**.o(.text+0x3bf):**.c: undefined reference to `L**ecuteScriptLng@8'1 s" H- J  y3 @7 P& o
**.o(.text+0x3e1):**.c: undefined reference to `LScloseLogFileLng@4'
% o( k: d4 K. @" E9 E**.o(.text+0x460):**.c: undefined reference to `LSdeleteEnvLng@4'
. y8 K7 N- m% \; i) Dcollect2: ld returned 1 exit status
6 c. Y& t( j# ?* x4 S' h
# t: \8 L' ~2 c0 B' U. I* g& Q: ~make.exe: *** [Project1.exe] Error 1- n8 k, u  b$ X
* @( x" m) G2 i" m
Execution terminated
/ D2 b3 T# l; X
回复

使用道具 举报

4

主题

3

听众

18

积分

升级  13.68%

该用户从未签到

本帖最后由 tomorrow0530 于 2011-5-23 15:21 编辑
7 K9 W4 F. U! ?: P
4 e* _! A' a3 v# E0 O3 {, kCompiler: Default compiler' M) a( K) P8 N" f7 D: B$ d
Building Makefile: "C:\LINGO11\Programming Samples\C++\s imple\Makefile.win"0 I0 j6 K. v, B& n- i. q
Executing  make...
0 x5 p) N- m1 s: G! _make.exe -f "C:\LINGO11\Programming Samples\C++\s imple\Makefile.win" all
3 i1 w: \2 f0 gg++.exe -c S imple.c -o S imple.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"  -I"../../"   
; \8 b0 x3 d4 ~$ _( {* _. E  Q
$ K- w' _$ D; ]( z& I1 ig++.exe S imple.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib" -L"C:/LINGO11/Programming Samples" ../../Lingd11.lib  ! b: h0 G. |" \

% d7 G' R+ {; v0 E, @1 t7 o, V
S imple.o(.text+0x15c):**.c: undefined reference to `LScreateEnvLng@0'
4 ^2 l: i3 z, X/ _. C9 oS imple.o(.text+0x1a6):**.c: undefined reference to `LSsetCallbackSolverLng@12') |  p7 D- c9 W3 X# a
S imple.o(.text+0x1eb):**.c: undefined reference to `LSopenLogFileLng@8'  d" ?2 w$ a1 F5 s
S imple.o(.text+0x224):**.c: undefined reference to `LSsetPointerLng@12': n% I, ]& L! S  u+ h' I
**.o(.text+0x25d):**.c: undefined reference to `LSsetPointerLng@12'
+ h# N5 c( H9 q+ e**.o(.text+0x296):**.c: undefined reference to `LSsetPointerLng@12'
6 m& a9 g/ I! |: ?! @**.o(.text+0x2cf):**.c: undefined reference to `LSsetPointerLng@12'
9 N- A  L4 W0 `, R- Z2 x7 u  l**.o(.text+0x308):**.c: undefined reference to `LSsetPointerLng@12'1 o  h8 M) V9 q" i+ B( S6 V) S* n/ E$ ?; K
**.o(.text+0x341):**.c: more undefined references to `LSsetPointerLng@12' follow
+ D6 y' @, x4 T* t**.o(.text+0x3bf):**.c: undefined reference to `L**ecuteScriptLng@8'
2 {+ l7 Y4 f4 B  p**.o(.text+0x3e1):**.c: undefined reference to `LScloseLogFileLng@4'
; M0 s: O" D. S# ~5 z3 J& z1 s5 B**.o(.text+0x460):**.c: undefined reference to `LSdeleteEnvLng@4'7 A& s. q( p# T+ f- ]0 `! |
collect2: ld returned 1 exit status
5 p* ]) r/ J  }9 ^2 h8 x# X# C# F' \# ]" I, Q, C; N$ L) m& s$ W
make.exe: *** [Project1.exe] Error 1$ w* }4 {! x/ W' f5 N! J
/ C9 E- T" w" E. \% Z% p  `
Execution terminated
; e: f4 q+ F: G& Z# j% r8 ]
5 A/ x& \: u& L; P9 z这次的编译结果,应该是s imple.o文件已经生成,但是生成project1.exe的时候出错了
回复

使用道具 举报

alair004        
头像被屏蔽

0

主题

4

听众

563

积分

升级  87.67%

  • TA的每日心情
    无聊
    2012-2-6 07:37
  • 签到天数: 4 天

    [LV.2]偶尔看看I

    提示: 作者被禁止或删除 内容自动屏蔽
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2026-4-17 19:46 , Processed in 0.978312 second(s), 71 queries .

    回顶部